+
    iHàjÁŠ  ã                  ó´  a€ 0 t $ R t^ RIHt ^ RIt^ RIt^ RIHt ^ RIH	t	H
t
HtHt ^ RIHtHt ^ RIHt ^ RIHtHtHtHtHt ]! 0 R[m4      t]! 0 R\m4      t]! R
04      tR]t^t^t^@tRt ^xt!]! 0 R^m4      t"]! 0 R_m4      t#R`t$RRaRRbRRcRRdRReRRf/t%R]&R&   ^2t'^2t(]! 0 Rgm4      t)R R lt*R R lt+]
! RR7       ! R R4      4       t,]
! RR7       ! R R4      4       t-]
! RR7       ! R R4      4       t.]
! RR7       ! R  R!4      4       t/]
! RR7       ! R" R#4      4       t0R$ R% lt1R& R' lt2R( R) lt3R*R+R,R-R.R/R0R1R2R3R4R5R6R7R8R9R:R;/	t4R<]&R=&   R>t5R?t6RRhR	Ri/t7R@]&RA&    ! RB RC4      t8RD RE lt9RF RG lt:RH RI lt;RJ RK lt<RL RM lt=RN RO lt>RjRP RQ llt?Rk U u/ uF  q RbK  	  up Rl U u/ uF  q RRbK  	  up ,          t@RS RT ltARU RV ltBRW RX ltCRY RZ ltDR# u up i u up i )ma  Pure tool-call loop guardrail primitives.

The controller is side-effect free: it tracks per-turn tool-call observations
and returns decisions. Runtime code decides whether a decision becomes warning
guidance, a synthetic tool result, or a controlled turn halt.
)ÚannotationsN)Údeque)ÚasdictÚ	dataclassÚfieldÚfields)ÚAnyÚMapping)Úsafe_json_loads)Úshape_failure_errorÚfile_mutation_result_landedÚhas_failure_markerÚis_guardrail_refusalÚis_rate_limitedÚ
web_searchÚdelegate_taskÚprocess_managei   Úexact_failure_warn_afterÚsame_tool_failure_warn_afterÚno_progress_warn_afterÚexact_failure_block_afterÚsame_tool_failure_halt_afterÚno_progress_block_afterzdict[str, tuple[str, str]]Ú_THRESHOLD_SOURCESc               ó    € V ^8„  d   QhRRRR/# ©é   Ú	tool_nameÚstrÚreturnÚbool© )Úformats   "Ú:/home/ubuntu/.hermes/hermes-agent/agent/tool_guardrails.pyÚ__annotate__r$   Y   s   € ÷ mñ m¨ð m°ñ mó    c                óN   € V \         9   ;'       g    V P                  \        4      # )z=Whether a tool is exempt from the identical-call loop notice.)ÚSTALL_GUARD_REPEATABLE_TOOLSÚendswithÚ _STALL_GUARD_REPEATABLE_SUFFIXES)r   s   &r#   Úis_stall_guard_repeatabler*   Y   s"   € àÔ4Ñ4×lÐl¸	×8JÑ8JÔKkÓ8lÐlr%   c               ó    € V ^8„  d   QhRRRR/# )r   Úplatformú
str | Noner   r    r!   )r"   s   "r#   r$   r$   ^   s   € ÷ ?ñ ?¨:ð ?¸$ñ ?r%   c                ó¨   € \        V \        4      '       d   V P                  4       '       g   R# V P                  4       P                  4       \        9  # )z?True for gateway/cron sessions where tool loops are unattended.F)Ú
isinstancer   ÚstripÚlowerÚ_ATTENDED_PLATFORMS)r,   s   &r#   Ú_is_non_interactive_platformr3   ^   s:   € ä�h¤×$Ò$¨H¯N©N×,<Ò,<ÙØ�>‰>Ó×!Ñ!Ó#Ô+>Ñ>Ð>r%   T)Úfrozenc                  óN   € ] tR t^et$ Rt]tR]R&   ]t	R]R&   ]
R R l4       tRtR# )	ÚLoopCapConfigzžPer-turn hard ceilings on web_search calls / subagent spawns; count total calls (not
repeats), fire regardless of ``hard_stop_enabled``; ``0`` disables a cap.ÚintÚmax_web_searchesÚmax_subagentsc               ó    € V ^8„  d   QhRRRR/# )r   ÚdataúMapping[str, Any] | Noner   r6   r!   )r"   s   "r#   r$   ÚLoopCapConfig.__annotate__n   s   € ÷ cñ cÐ 8ð c¸]ñ cr%   c                óø   € \        V\        4      '       g   V ! 4       # T ! R/ \        V 4       Uu/ uF=  q"P                  \	        VP                  VP                  4      VP                  ^ 4      bK?  	  upB # u upi )zABuild config from the ``tool_loop_guardrails.loop_caps`` section.r!   )r/   r	   r   ÚnameÚ_int_at_leastÚgetÚdefault)Úclsr;   Úfs   && r#   Úfrom_mappingÚLoopCapConfig.from_mappingm   sc   € ô ˜$¤×(Ò(Ù“5ˆLÙÑbÔU[Ð\_ÔU`ÓaÑU`ÐPQ—f‘fœm¨D¯H©H°Q·V±VÓ,<¸a¿i¹iÈÓKÒKÑU`ÑaÑbÐbùÒas   ¯AA7r!   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú"_DEFAULT_MAX_WEB_SEARCHES_PER_TURNr8   Ú__annotations__Ú_DEFAULT_MAX_SUBAGENTS_PER_TURNr9   ÚclassmethodrE   Ú__static_attributes__r!   r%   r#   r6   r6   e   s3   ‡ ñQð ?Ð�cÓ>Ø8€M�3Ó8àôcó ôcr%   r6   c                  ó  € ] tR t^ut$ RtRtR]R&   RtR]R&   RtR]R&   ^t	R]R	&   ^t
R]R
&   ^tR]R&   ^tR]R&   ^tR]R&   ^tR]R&   ]! R R7      tR]R&   ]! R R7      tR]R&   ]! ]R7      tR]R&   ]RR/R R ll4       tRtR# )ÚToolCallGuardrailConfigzµThresholds for per-turn tool-call loop detection. Warnings never prevent execution; hard
stops are opt-in on interactive platforms, default on for unattended gateway/cron platforms.Tr    Úwarnings_enabledFÚhard_stop_enabledÚ!non_interactive_hard_stop_enabledr7   r   r   r   r   r   r   c                 	ó   € \         # ©N)ÚIDEMPOTENT_TOOL_NAMESr!   r%   r#   Ú<lambda>Ú ToolCallGuardrailConfig.<lambda>ƒ   s   € ÕEZr%   )Údefault_factoryzfrozenset[str]Úidempotent_toolsc                 	ó   € \         # rW   )ÚMUTATING_TOOL_NAMESr!   r%   r#   rY   rZ   „   s   € ÕCVr%   Úmutating_toolsr6   Ú	loop_capsr,   Nc               ó$   € V ^8„  d   QhRRRRRR/# )r   r;   r<   r,   r-   r   rR   r!   )r"   s   "r#   r$   Ú$ToolCallGuardrailConfig.__annotate__ˆ   s)   € ÷ gñ gØ+ðgØ:Dðgà	 ñgr%   c               óâ  aa€ \        S\        4      '       g   / oV ! 4       o\         Uu/ uF(  q3\        SP	                  V4      \        SV4      4      bK*  	  ppVR,          '       d   \        V4      '       d   RVR&   R VV3R llp\        P                  4        UUu/ uF  w  r6W5! V.VO5!  bK  	  pppV ! RR\        P                  SP	                  R4      4      /VBVB # u upi u uppi )zpBuild config from `tool_loop_guardrails`; nested ``warn_after`` / ``hard_stop_after`` win over flat legacy keys.rU   TrT   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r?   r   Úsection_nameÚkeyr   r7   r!   )r"   s   "r#   r$   Ú:ToolCallGuardrailConfig.from_mapping.<locals>.__annotate__“   s(   € ÷ 	>ñ 	>˜Cð 	>¨sð 	>¸ð 	>Àñ 	>r%   c                óä   <€ SP                  V4      p\        V\        4      '       d"   VP                  VSP                  V 4      4      MSP                  V 4      p\        V\	        SV 4      ^4      # )é   )rA   r/   r	   r@   Úgetattr)r?   re   rf   ÚsectionÚnestedÚdr;   s   &&&  €€r#   Ú	thresholdÚ7ToolCallGuardrailConfig.from_mapping.<locals>.threshold“   sZ   ø€ Ø—h‘h˜|Ó,ˆGÜ9CÀGÌW×9UÒ9U�W—[‘[  d§h¡h¨t£nÔ5Ð[_×[cÑ[cÐdhÓ[iˆFÜ  ¬°°DÓ)9¸1Ó=Ð=r%   r`   r!   )r/   r	   Ú_BOOL_FIELDSÚ_as_boolrA   rj   r3   r   Úitemsr6   rE   )	rC   r;   r,   r?   Úflagsrn   ÚsrcÚ
thresholdsrm   s	   &f$     @r#   rE   Ú$ToolCallGuardrailConfig.from_mapping‡   sæ   ù€ ô
 ˜$¤×(Ò(ØˆDÙ‹EˆÝNZÓ[ÉlÀd”x §¡¨£´¸¸4Ó0@ÓAÒAÉlˆÐ[ØÐ4×5Ô5Ô:VÐW_×:`Ò:`Ø)-ˆEÐ%Ñ&÷	>ñ 	>ô
 DV×C[ÑC[ÔC]Ô^ÑC]±i°d�d˜I dÐ1¨SÓ1Ò1ÑC]ˆ
Ñ^ÙÑfœ]×7Ñ7¸¿¹ÀÓ8MÓNÐfÐRWÐfÐ[eÑfÐfùò \ùó _s   ª.C&Â C+r!   )rG   rH   rI   rJ   rK   rS   rM   rT   rU   r   r   r   r   r   r   r   r\   r_   r6   r`   rO   rE   rP   r!   r%   r#   rR   rR   u   sº   ‡ ñdð "Ð�dÓ!Ø#Ð�tÓ#Ø.2Ð% tÓ2Ø$%Ð˜cÓ%Ø%&Ð˜sÓ&Ø()Ð  #Ó)Ø()Ð  #Ó)Ø"#Ð˜CÓ#Ø#$Ð˜SÓ$Ù',Ñ=ZÔ'[Ð�nÓ[Ù%*Ñ;VÔ%W€N�NÓWÙ$°]ÔC€Iˆ}ÓCàðgØGKögó ôgr%   rR   c                  óF   € ] tR t^œt$ RtRtR]R&   RtR]R&   RtR]R&   Rt	R# )ÚIdenticalCallObservationz¾``notice`` is appended after the result, ``stub`` replaces a byte-identical duplicate result;
``kind`` names the detector behind the notice (``identical_call_streak`` / ``identical_cycle``).Nr-   ÚnoticeÚstubÚkindr!   )
rG   rH   rI   rJ   rK   ry   rM   rz   r{   rP   r!   r%   r#   rx   rx   œ   s(   ‡ ñhð €FˆJÓØ€Dˆ*ÓØ€Dˆ*×r%   rx   c                  óR   € ] tR t^¦t$ RtR]R&   R]R&   ]R R l4       tR R ltR	t	R
# )ÚToolCallSignaturezDStable, non-reversible identity for a tool name plus canonical args.r   r   Ú	args_hashc               ó$   € V ^8„  d   QhRRRRRR/# )r   r   r   Úargsr<   r   r}   r!   )r"   s   "r#   r$   ÚToolCallSignature.__annotate__®   s(   € ÷ \ñ \ #ð \Ð-Eð \ÐJ[ñ \r%   c           	     	óN   € T ! T\        \        T;'       g    / 4      4      R 7      # ))r   r~   )Ú_sha256Úcanonical_tool_args)rC   r   r€   s   &&&r#   Ú	from_callÚToolCallSignature.from_call­   s!   € á˜Y´'Ô:MÈdÏjÈjÐVXÓ:YÓ2ZÔ[Ð[r%   c               ó   € V ^8„  d   QhRR/# )r   r   údict[str, str]r!   )r"   s   "r#   r$   r�   ±   s   € ÷ ñ ˜^ñ r%   c                ó   € \        V 4      # )z3Return public metadata without raw argument values.©r   ©Úselfs   &r#   Úto_metadataÚToolCallSignature.to_metadata±   s   € ä�d‹|Ðr%   r!   N)
rG   rH   rI   rJ   rK   rM   rO   r…   r�   rP   r!   r%   r#   r}   r}   ¦   s-   ‡ áNàƒNØƒNàô\ó ð\÷ñ r%   r}   c                  ó¨   € ] tR t^¶t$ RtRtR]R&   RtR]R&   RtR]R&   Rt	R]R&   ^ t
R	]R
&   RtR]R&   ]R R l4       t]R R l4       tR R ltRtR# )ÚToolGuardrailDecisionz8Decision returned by the tool-call guardrail controller.Úallowr   ÚactionÚcodeÚ Úmessager   r7   ÚcountNzToolCallSignature | NoneÚ	signaturec               ó   € V ^8„  d   QhRR/# ©r   r   r    r!   )r"   s   "r#   r$   Ú"ToolGuardrailDecision.__annotate__Â   s   € ÷ 0ñ 0 $ñ 0r%   c                	ó    € V P                   R9   # )r‘   >   Úwarnr‘   ©r’   r‹   s   &r#   Úallows_executionÚ&ToolGuardrailDecision.allows_executionÁ   ó   € à�{‰{Ð/Ñ/Ð/r%   c               ó   € V ^8„  d   QhRR/# r™   r!   )r"   s   "r#   r$   rš   Æ   s   € ÷ 0ñ 0˜Tñ 0r%   c                	ó    € V P                   R9   # )Úblock>   Úhaltr£   r�   r‹   s   &r#   Úshould_haltÚ!ToolGuardrailDecision.should_haltÅ   r    r%   c               ó   € V ^8„  d   QhRR/# )r   r   zdict[str, Any]r!   )r"   s   "r#   r$   rš   É   s   € ÷ ñ ˜^ñ r%   c                	ó8   € \        V 4      pVR ,          f   VR  V# )r—   rŠ   )rŒ   r;   s   & r#   r�   Ú!ToolGuardrailDecision.to_metadataÉ   s#   € Ü�d‹|ˆØ�ÕÒ$Ø�[Ð!Øˆr%   r!   )rG   rH   rI   rJ   rK   r’   rM   r“   r•   r   r–   r—   Úpropertyrž   r¥   r�   rP   r!   r%   r#   r�   r�   ¶   sq   ‡ áBà€FˆCÓØ€Dˆ#ÓØ€GˆSÓØ€IˆsÓØ€Eˆ3ƒNØ*.€IÐ'Ó.àô0ó ð0ð ô0ó ð0÷ñ r%   r�   c               ó    € V ^8„  d   QhRRRR/# )r   Úvaluer   r   r   r!   )r"   s   "r#   r$   r$   Ð   s   € ÷ eñ e˜3ð e 3ñ er%   c                ó@   € \         P                  ! V R RR\        R7      # )FT)Úensure_asciiÚ	sort_keysÚ
separatorsrB   )Ú,Ú:)ÚjsonÚdumpsr   ©r¬   s   &r#   Ú_canonical_jsonr¶   Ð   s   € Ü�:Š:�e¨%¸4ÈJÔ`cÔdÐdr%   c               ó    € V ^8„  d   QhRRRR/# )r   r€   úMapping[str, Any]r   r   r!   )r"   s   "r#   r$   r$   Ô   s   € ÷ !ñ !Ð/ð !°Cñ !r%   c                ó†   € \        V \        4      '       g"   \        R\        V 4      P                   24      h\        V 4      # )z5Return sorted compact JSON for parsed tool arguments.z!tool args must be a mapping, got )r/   r	   Ú	TypeErrorÚtyperG   r¶   ©r€   s   &r#   r„   r„   Ô   s8   € ä�dœG×$Ò$ÜÐ;¼DÀ»J×<OÑ<OÐ;PÐQÓRÐRÜ˜4Ó Ð r%   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r   r   Úresultr-   r   ztuple[bool, str]r!   )r"   s   "r#   r$   r$   Û   s'   € ÷ Mñ M Sð M°*ð MÐAQñ Mr%   c                ó„  € Ve   \        W4      '       d   R# \        V4      '       d   R# V R8X  dJ   \        V4      p\        V\        4      '       d   VP                  R4      MRpVe   V^ 8w  d	   RRV R23# R# \        V4      p\        V\        4      '       d’   VP                  R	4      RJ pV R
8X  d"   V'       d   RVP                  RR4      9   d   R# VP                  R4      ;'       g    VP                  R4      pV'       d   V'       g   RV9   g   \        V4      '       d   R# R# \        V4      '       d   R# R# )z±Fallback classifier used only when callers don't pass ``failed``; mirrors
``agent.display._detect_tool_failure`` so the guardrail never disagrees with the CLI's ``[error]`` tag.NFr”   ÚterminalÚ	exit_codeTz [exit Ú]ÚsuccessÚmemoryzexceed the limitÚerrorr•   )Fr”   )Tz [full])Tz [error])r   r   r
   r/   ÚdictrA   r   r   )r   r¾   r;   rÁ   ÚfailedÚerrs   &&    r#   Úclassify_tool_failurerÉ   Û   s)  € ð ‚~Ô4°Y×GÒGØÐô ˜F×#Ò#ØÐà�JÔÜ˜vÓ&ˆÜ-7¸¼d×-CÒ-C�D—H‘H˜[Ô)Èˆ	Ø1:Ò1FÈ9ÐXYÌ>�˜ 	˜{¨!Ð,Ð-ÐjÐ_jÐjä˜6Ó"€DÜ�$œ×ÒØ—‘˜)Ó$¨Ð-ˆØ˜Ô §VÐ0BÀdÇhÁhÈwÐXZÓF[Ô0[Ø"Ð"ð �h‰h�wÓ×6Ð6 4§8¡8¨IÓ#6ˆß&)¯v¸ÀD¼ÔNaÐbf×NgÒNgÐ!ÐxÐmxÐxÜ!3°F×!;Ò!;ÐÐLÀÐLr%   Úrepeated_exact_failure_blockzšBlocked {tool_name}: the same tool call failed {count} times with identical arguments. Stop retrying it unchanged; change strategy or explain the blocker.Úidempotent_no_progress_blockz§Blocked {tool_name}: this read-only call returned the same result {count} times. Stop repeating it unchanged; use the result already provided or try a different query.Úsame_tool_failure_haltz�Stopped {tool_name}: it failed {count} times this turn. Stop retrying the same failing tool path and choose a different approach.Úrepeated_exact_failure_warningzž{tool_name} has failed {count} times with identical arguments. This looks like a loop; inspect the error and change strategy instead of retrying it unchanged.Úidempotent_no_progress_warningzŠ{tool_name} returned the same result {count} times. Use the result already provided or change the query instead of repeating it unchanged.Úidentical_call_streak_haltz½Stopped {tool_name}: the same call with identical arguments returned the same result {count} times in a row. Stop repeating it unchanged; use the result already provided or change strategy.Úidentical_cycle_haltz÷Stopped {tool_name}: the same repeating cycle of tool calls (period {period}) with identical arguments and identical results has run {count} times. Repeating the batch unchanged is not progress; use the results already provided or change strategy.Úloop_web_search_capzÃBlocked web_search: this turn has already made {cap} web searches, the per-turn limit. This looks like a runaway search loop. Work with the results you already have and give the user your answer.Úloop_subagent_capz¿Blocked delegate_task: this turn has already spawned {count} subagents (limit {cap}). This looks like a runaway delegation loop. Finish the work with the results you have and answer the user.rˆ   Ú_DECISION_MESSAGESuÞ   [hermes note: this is the {ordinal} consecutive identical call to {tool_name} with identical arguments returning the same result. Do not repeat it â€” change arguments, use a different tool, or proceed with what you have.]u  [hermes note: the last {count} rounds repeated the same cycle of {period} tool calls (ending with {tool_name}) with identical arguments and identical results. Do not repeat the batch â€” change arguments, use a different tool, or proceed with what you have.]zdict[str, tuple[str, str, str]]Ú
_LOOP_CAPSc                  óÔ   € ] tR tRtRtR"R R lltR R lt]R R	 l4       tR
R/R R llt	R R lt
RR/R R l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!tR# )#ÚToolCallGuardrailControlleri8  zCPer-turn controller for repeated failed/non-progressing tool calls.Nc               ó   € V ^8„  d   QhRR/# )r   ÚconfigzToolCallGuardrailConfig | Noner!   )r"   s   "r#   r$   Ú(ToolCallGuardrailController.__annotate__;  s   € ÷ ñ Ð=ñ r%   c                	óX   € T;'       g    \        4       V n        V P                  4        R # rW   )rR   rØ   Úreset_for_turn)rŒ   rØ   s   &&r#   Ú__init__Ú$ToolCallGuardrailController.__init__;  s!   € Ø×9Ð9Ô 7Ó 9ˆŒØ×ÑÖr%   c               ó   € V ^8„  d   QhRR/# )r   r   ÚNoner!   )r"   s   "r#   r$   rÙ   ?  s   € ÷ &ñ & ñ &r%   c                	óØ   € / V n         / V n        / V n        / V n        R V n        R V n        RV n        ^ V n        RV n        \        \        R7      V n        / V n        ^ V n        ^ V n        R # )Nr”   )Úmaxlen)Ú_exact_failure_countsÚ_same_tool_failure_countsÚ_progress_since_failureÚ_no_progressÚ_halt_decisionÚ_identical_streak_sigÚ_identical_streak_result_hashÚ_identical_streak_countÚ_identical_streak_first_call_idr   Ú_STALL_GUARD_CYCLE_HISTORYÚ_call_historyÚ_persisted_result_pathsÚ_turn_web_search_countÚ_turn_subagent_countr‹   s   &r#   rÛ   Ú*ToolCallGuardrailController.reset_for_turn?  sx   € ØCEˆÔ"Ø9;ˆÔ&àFHˆÔ$ØFHˆÔØ<@ˆÔð @DˆÔ"Ø24ˆÔ*Ø,-ˆÔ$Ø46ˆÔ,ô JOÔVpÔIqˆÔà79ˆÔ$Ø&'ˆÔ#Ø$%ˆÖ!r%   c               ó   € V ^8„  d   QhRR/# )r   r   úToolGuardrailDecision | Noner!   )r"   s   "r#   r$   rÙ   [  s   € ÷ #ñ #Ð;ñ #r%   c                	ó   € V P                   # rW   )ræ   r‹   s   &r#   Úhalt_decisionÚ)ToolCallGuardrailController.halt_decisionZ  s   € à×"Ñ"Ð"r%   r•   c               ó8   € V ^8„  d   QhRRRRRRRRRRR	R
RRRR/# )r   r’   r   r“   r   r–   r7   r—   r}   r•   r-   Úfmtr   r   r�   r!   )r"   s   "r#   r$   rÙ   ^  sN   € ÷ 
ñ 
Øð
Ø!$ð
Ø14ð
Ø=@ð
ØM^ð
àð
à.1ð
ð 
ñ
r%   c               óš   € Vf"   \         V,          P                  ! RRVRV/VB p\        WWcWE4      pVP                  '       d   W€n        V# )zZBuild a warn/block/halt decision; block/halt is also recorded as the turn's halt decision.r   r–   r!   )rÓ   r"   r�   r¥   ræ   )	rŒ   r’   r“   r   r–   r—   r•   r÷   Údecisions	   &&&&&&$, r#   Ú_decideÚ#ToolCallGuardrailController._decide^  sR   € ð
 Š?Ü(¨Õ.×5Ò5Ñ^À	Ð^ÐQVÐ^ÐZ]Ñ^ˆGÜ(¨°wÈ5Ó\ˆØ××ÐØ"*ÔØˆr%   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r   r   r€   r<   r   r�   r!   )r"   s   "r#   r$   rÙ   j  s#   € ÷ ñ  Sð Ð0Hð ÐMbñ r%   c                	óž  € \        V4      p\        P                  W4      p\        WR 7      pV P	                  WV4      pVf   V P
                  P                  '       g   T;'       g    T# V P                  P                  V4      '       d   ^ MV P                  P                  V^ 4      pW`P
                  P                  8¼  d   V P                  RRWV4      # V P                  V4      '       d   V P                  P                  V4      MRpVe>   V^,          V P
                  P                  8¼  d   V P                  RRW^,          V4      # V# )©r   r—   Nr£   rÊ   rË   )Ú_coerce_argsr}   r…   r�   Ú_check_loop_caprØ   rT   rä   rA   râ   r   rú   Ú_is_idempotentrå   r   )rŒ   r   r€   r—   r‘   Ú	cap_blockÚexact_countÚrecords   &&&     r#   Úbefore_callÚ'ToolCallGuardrailController.before_callj  s  € Ü˜DÓ!ˆÜ%×/Ñ/°	Ó@ˆ	Ü%°	ÔOˆð ×(Ñ(¨¸)ÓDˆ	ØÒ ¨¯©×(E×(EÐ(EØ×%Ð% Ð%à×7Ñ7×;Ñ;¸I×FÒF‘aÈD×LfÑLf×LjÑLjÐktÐvwÓLxˆØŸ+™+×?Ñ?Ô?Ø—<‘< Ð)GÈÐajÓkÐkØ59×5HÑ5HÈ×5SÒ5S�×"Ñ"×&Ñ& yÔ1ÐY]ˆØÒ &¨¥)¨t¯{©{×/RÑ/RÔ"RØ—<‘< Ð)GÈÐ[\ÕT]Ð_hÓiÐiØˆr%   rÇ   c          
     ó,   € V ^8„  d   QhRRRRRRRRR	R
/# )r   r   r   r€   r<   r¾   r-   rÇ   zbool | Noner   r�   r!   )r"   s   "r#   r$   rÙ   |  sD   € ÷ Acñ AcØðAcØ$<ðAcØFPðAcàðAcð 
ñAcr%   c               	ó  € \        V4      p\        P                  W4      pVf   \        W4      w  rFV P                  P
                  pV'       Ed³   V P                  P                  VR4      '       d   V P                  P                  VR 4       \        V4      pV P                  P                  V^ 4      p	V'       g   V	^,           ;q�P                  V&   V P                  P                  V^ 4      ^,           ;q P                  V&   V P                  P                  VR 4       V P                  P                  '       d:   V\        9  d/   W P                  P                  8¼  d   V P!                  RRWV4      # V'       d7   V'       g/   W�P                  P"                  8¼  d   V P!                  RRWV4      # V'       d:   W P                  P$                  8¼  d    V P!                  RRWV\'        W4      R7      # \)        WVR7      # V P                  P                  VR 4       V P                  P                  VR 4       V\*        9   g   \-        W4      '       dT   V P                  P/                  \0        P3                  V P                  R	4      4       V P                  P5                  4        V P7                  V4      '       g)   V P                  P                  VR 4       \)        WR
7      # \9        W14      pV P                  P                  V4      pVe   V^ ,          V8X  d   V^,          ^,           M^pW½3V P                  V&   V'       d/   WÐP                  P:                  8¼  d   V P!                  RRWV4      # \)        WVR7      # )NFr¤   rÌ   rœ   rÍ   Úsame_tool_failure_warning)r•   )r   r–   r—   Trþ   rÎ   )rÿ   r}   r…   rÉ   rØ   rS   rä   Úpoprâ   r   rA   rã   rå   rT   ÚFAILURE_TOLERANT_TOOL_NAMESr   rú   r   r   Ú_tool_failure_recovery_hintr�   ÚPROGRESS_RESET_TOOL_NAMESr   ÚupdaterÆ   ÚfromkeysÚclearr  Ú_result_hashr   )rŒ   r   r€   r¾   rÇ   r—   Ú_ÚwarningsÚ	throttledr  Ú
same_countÚresult_hashÚpreviousÚrepeat_counts   &&&&$         r#   Ú
after_callÚ&ToolCallGuardrailController.after_call|  sç  € ô ˜DÓ!ˆÜ%×/Ñ/°	Ó@ˆ	ØŠ>Ü-¨iÓ@‰IˆFØ—;‘;×/Ñ/ˆçˆ6ð ×+Ñ+×/Ñ/°	¸5×AÒAØ×*Ñ*×.Ñ.¨y¸$Ô?ô
 (¨Ó/ˆIØ×4Ñ4×8Ñ8¸ÀAÓFˆKßØFQÐTUÅoÐU�×8Ñ8¸ÑCØEI×EcÑEc×EgÑEgÐhqÐstÓEuÐxyÕEyÐyˆJ×7Ñ7¸	ÑBØ×Ñ×!Ñ! )¨TÔ2ð —‘×-×-Ð-ØÔ%@Ô@Ø§+¡+×"JÑ"JÔJà—|‘| FÐ,DÀiÐ]fÓgÐgß§	¨k¿[¹[×=aÑ=aÔ.aØ—|‘| FÐ,LÈiÐfoÓpÐpß˜J¯+©+×*RÑ*RÔRØ—|‘|ØÐ7¸ÐPYÜ7¸	ÓNð $ó ð ô )°9Ð[dÔeÐeà×"Ñ"×&Ñ& y°$Ô7Ø×&Ñ&×*Ñ*¨9°dÔ;ð Ô1Ô1Ô5PÐQZ×5cÒ5cØ×(Ñ(×/Ñ/´·±¸d×>XÑ>XÐZ^Ó0_Ô`Ø×*Ñ*×0Ñ0Ô2Ø×"Ñ" 9×-Ò-Ø×Ñ×!Ñ! )¨TÔ2Ü(°9ÔRÐRä" 6Ó5ˆØ×$Ñ$×(Ñ(¨Ó3ˆØ*2Ò*>À8ÈAÅ;ÐR]ÔC]�x •{ Q–ÐcdˆØ(3Ð'Bˆ×Ñ˜)Ñ$ß˜¯©×(JÑ(JÔJØ—<‘< Ð(HÈ)ÐclÓmÐmÜ$¨yÐXaÔbÐbr%   c               ó    € V ^8„  d   QhRRRR/# r   r!   )r"   s   "r#   r$   rÙ   ¿  s   € ÷ iñ i¨ð i°ñ ir%   c                	ór   € WP                   P                  9  ;'       d    WP                   P                  9   # rW   )rØ   r_   r\   )rŒ   r   s   &&r#   r  Ú*ToolCallGuardrailController._is_idempotent¿  s*   € Ø§¡× :Ñ :Ñ:×hÐh¸yÏKÉK×LhÑLhÑ?hÐhr%   Útool_call_idr”   Fc               ó0   € V ^8„  d   QhRRRRRRRRRR	R
R/# )r   r   r   r€   r<   r¾   r-   r  rÇ   r    r   rx   r!   )r"   s   "r#   r$   rÙ   Â  sF   € ÷ 3Mñ 3MØð3MØ$<ð3MØFPð3Màð3Mà+/ð3Mð 
"ñ3Mr%   c          	     ó  € \        V\        4      p\        P                  V\	        V4      4      pV'       d   \        W14      MRpV'       d9   Wx3V P                  V P                  38X  d   V ;P                  ^,          un        M9V'       d   TMRV n        W€n        V'       d   ^M^ V n        T;'       g    RV n	        V P                  p	R;r«\        V4      '       g…   V	\        8¼  dz   \        P                  \        V	4      VR7      RrºV P                  P                   '       d=   W�P                  P"                  8¼  d#   V P$                  f   V P'                  RRWV4       V'       d(   V P(                  P+                  Wx\        V4      34       MV P(                  P-                  4        V
f’   V'       dŠ   V P/                  4       pVev   Vw  rÞ\0        P                  WíVR7      RrºV P                  P                   '       d>   WàP                  P"                  8¼  d$   V P$                  f   V P'                  RR	WW}R
7       RpV'       d5   V	^8¼  d.   V'       g&   \3        V4      \4        8¼  d   V P7                  W4      p\9        W¯VR7      # )u¾  Track consecutive identical calls; return notice + dedupe stub info.

``notice`` fires from the threshold-th consecutive identical (tool, args, result) call
(observational, pollers exempt). ``stub`` replaces the CURRENT result from the 2nd byte-identical
repeat â€” the tool still executed, only the context representation is deduplicated, so polling
semantics survive; pollers are NOT exempt here since an unchanged poll is where it saves most.
r”   N)Úordinalr   Úidentical_call_streakr¤   rÏ   )r–   Úperiodr   Úidentical_cyclerÐ   )r#  )ry   rz   r{   )r/   r   r}   r…   rÿ   r  rç   rè   ré   rê   r*   Ú$STALL_GUARD_IDENTICAL_CALL_THRESHOLDÚ_IDENTICAL_CALL_NOTICEr"   Ú_ordinalrØ   rT   r   ræ   rú   rì   Úappendr  Ú_detect_identical_cycleÚ_IDENTICAL_CYCLE_NOTICEÚlenÚIDENTICAL_RESULT_STUB_MIN_CHARSÚ_build_result_reference_stubrx   )rŒ   r   r€   r¾   r  rÇ   Úis_plain_strr—   r  r–   ry   r{   Úcycler#  Úlapsrz   s   &&&&$$          r#   Úobserve_callÚ(ToolCallGuardrailController.observe_callÂ  s  € ô " &¬#Ó.ˆÜ%×/Ñ/°	¼<ÈÓ;MÓNˆ	ß9E”l 6Ô5È2ˆç˜YÐ4¸×9SÑ9SÐUY×UwÑUwÐ8xÔxØ×(Ò(¨AÕ-Ö(÷ 7C©ÈˆDÔ&Ø1<Ô.ß0<©1À!ˆDÔ(Ø3?×3EÐ3EÀ2ˆDÔ0Ø×,Ñ,ˆàÐˆÜ(¨×3Ò3¸ÔAeÔ8eÜ1×8Ñ8ÄÈ%ÃÐ\eÐ8ÓfÐh�Dð �{‰{×,×,Ð,°¿+¹+×:]Ñ:]Ô1]Ðbf×buÑbuÒb}Ø—‘˜VÐ%AÀ9ÐU^Ô_÷ Ø×Ñ×%Ñ% yÔ?XÐYbÓ?cÐ&dÕeà×Ñ×$Ñ$Ô&ØŠ>ŸlØ×0Ñ0Ó2ˆEØÒ Ø$‘�Ü6×=Ñ=ÀDÐclÐ=Ómð  pA˜Ø—;‘;×0×0Ð0°T¿[¹[×=`Ñ=`Ô5`Ðei×exÑexò  fAØ—L‘L Ð)?ÀÐR[�LÔkàˆß˜E QœJ¯v¼#¸f»+ÔIhÔ:hØ×4Ñ4°YÓEˆDÜ'¨vÀtÔLÐLr%   c               ó   € V ^8„  d   QhRR/# )r   r   ztuple[int, int] | Noner!   )r"   s   "r#   r$   rÙ   ÷  s   € ÷  ñ  Ð)?ñ  r%   c                óÐ  aaa€ V P                   o\        ^\        ^,           4       EF5  o\        S4      S\        ,          8  d   K!  ^p \        S4      SV^,           ,          ,
          oS^ 8  d   Md\
        ;QJ d*    VVV3R l\        S4       4       F  '       d   K   RM	  RM! VVV3R l\        S4       4       4      pV'       g   MV^,          pK�  V\        8¼  g   K½  \        S4       Uu. uF#  pS\        S4      S,
          V,           ,          NK%  	  pp\
        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       d   EK2  SV3u # 	  R# u upi )aã  Detect a repeating identical-call cycle ending at the latest observed call.

Returns ``(period, laps)`` for the smallest period 2..max whose trailing laps
(identical signature AND result per position) reach the notice threshold, else None.
Period 1 is the consecutive streak's job. A cycle made ONLY of poller-exempt tools
is exempt (an unchanged poll loop is legitimate waiting); one non-exempt call in
the cycle keeps the guard armed, matching the single-call exemption semantics.
Tc              3  ó¢   <"  € T FD  pSSV,           ,          R ,          S\        S4      S,
          V,           ,          R ,          8H  x € KF  	  R# 5i):Nr   NN)r+  )Ú.0ÚiÚbaseÚhistoryr#  s   & €€€r#   Ú	<genexpr>ÚFToolCallGuardrailController._detect_identical_cycle.<locals>.<genexpr>
  sD   øé € ð  á*˜ð ˜D 1�HÕ% bÕ)¨W´S¸³\ÀFÕ5JÈQÕ5NÕ-OÐPRÕ-SÖSÛ*ùs   ƒAAFc              3  ó,   "  € T F
  w   rVx € K  	  R # 5irW   r!   )r6  r  Ú
repeatables   &  r#   r:  r;    s   é € Ð?¹$Ñ&6 a¨•z»$ùs   ‚N)rì   ÚrangeÚ_STALL_GUARD_MAX_CYCLE_PERIODr+  r%  Úall)rŒ   r0  Ú	lap_equalr7  Útailr8  r9  r#  s   &    @@@r#   r)  Ú3ToolCallGuardrailController._detect_identical_cycle÷  s  ú€ ð ×$Ñ$ˆÜ˜AÔ<¸qÕ@×AˆFÜ�7‹|˜fÔ'KÕKÔKÙØˆDàÜ˜7“| f°°qµÕ&9Õ9�Ø˜!”8Øß›Cö  ä" 6œ]ó ŸCŸCšCö  ä" 6œ]ó ó �	÷ !ØØ˜•	’ØÔ;Ö;ÜDIÈ&ÄMÓRÁM¸q˜¤ G£¨vÕ 5¸Õ 9×:Ð:ÁM�ÐRß“3Ñ?¹$Ó?—3—3’3Ñ?¹$Ó?×?Ò?Úà˜t�|Ò#ñ+ Bñ, ùò Ss   Ã1)E#c               ó$   € V ^8„  d   QhRRRRRR/# )r   r  r   Ú	file_pathr   rß   r!   )r"   s   "r#   r$   rÙ     s&   € ÷ Cñ C°Cð CÀCð CÈDñ Cr%   c                óJ   € V'       d   V'       d   W P                   V&   R# R# R# )z<Remember the spillover path a persisted result was saved to.N)rí   )rŒ   r  rE  s   &&&r#   Úrecord_persisted_resultÚ3ToolCallGuardrailController.record_persisted_result  s   € çŸIØ9B×(Ñ(¨Ó6ñ &‰<r%   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r   r   r€   r<   r   r!   )r"   s   "r#   r$   rÙ     s#   € ÷ ñ °cð ÐAYð Ð^añ r%   c                ó:  € \        \        V4      4      p\        V4      \        8”  d   VR\         R,           pV P                  pV'       d   RV R2MRpRV RV RV R	2pV'       d   V P
                  P                  V4      MRpV'       d   VR
V R2,          pV# )zKReference stub for a byte-identical duplicate result (tool + args preview).Nu   â€¦z (tool_call_id Ú)r”   z3[hermes note: this result is byte-identical to the z result earlier this turnz2. Refer to that result; it has not changed. Args: rÂ   z*
[The referenced result was persisted to: uB    â€” page through it with read_file if you need the full content.])r„   rÿ   r+  Ú_RESULT_STUB_ARGS_PREVIEW_CHARSrê   rí   rA   )rŒ   r   r€   Úargs_previewÚfirst_idÚrefrz   Ú
spill_paths   &&&     r#   r-  Ú8ToolCallGuardrailController._build_result_reference_stub  s½   € ä*¬<¸Ó+=Ó>ˆÜˆ|ÓÔ>Ô>Ø'Ð(HÔ)HÐIÈEÕQˆLØ×7Ñ7ˆß/7� ˜z¨Ñ+¸RˆàAÀ)Àð M'Ø'* eð ,Ø*˜^¨1ð.ð 	÷
 DL�T×1Ñ1×5Ñ5°hÔ?ÐQUˆ
ßØÐAÀ*Àð  NPð  Qõ  QˆDØˆr%   c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   r   r   r€   r¸   r—   r}   r   rò   r!   )r"   s   "r#   r$   rÙ   /  s,   € ÷ ñ ØðØ$5ðØBSðà	%ñr%   c           	     óP  € \         P                  V4      pVf   R# Vw  rVp\        V P                  P                  V4      \        W4      r˜VR8X  d   ^MV'       d   \        V4      M^ p
V
'       d$   V'       d   W˜8¼  d   V P                  RWqW“VR7      # \        WWš,           4       R# )zËBlock once a per-turn cap is reached (BEFORE the call, so the (cap+1)-th is refused), else advance
the counter and return None. delegate_task control actions spawn nothing and keep working after the cap.Nr   r£   )Úcap)rÔ   rA   rj   rØ   r`   Ú_subagent_spawn_countrú   Úsetattr)rŒ   r   r€   r—   ÚspecÚ	cap_fieldÚ
count_attrr“   rT  r–   Ú	increments   &&&&       r#   r   Ú+ToolCallGuardrailController._check_loop_cap/  sŒ   € ô
 �~‰~˜iÓ(ˆØŠ<ÙØ&*Ñ#ˆ	˜tÜ˜TŸ[™[×2Ñ2°IÓ>ÄÈÓ@YˆUØ" lÔ2‘A×X[Ô9NÈtÔ9TÐabˆ	ßŸ ¤Ø—<‘< ¨¸%ÐPS�<ÓTÐTÜ� %Õ"3Ô4Ùr%   )rì   râ   ræ   ré   rê   rè   rç   rå   rí   rä   rã   rï   rî   rØ   rW   )rG   rH   rI   rJ   rK   rÜ   rÛ   rª   rô   rú   r  r  r  r1  r)  rG  r-  r   rP   r!   r%   r#   rÖ   rÖ   8  s�   † ÙM÷õ&ð6 ô#ó ð#ð
à!%÷
õð$Acà!%÷AcõFið3Mà!ð3Mà27÷3Mõj õDCõ
÷"ñ r%   rÖ   c               ó    € V ^8„  d   QhRRRR/# )r   rù   r�   r   r   r!   )r"   s   "r#   r$   r$   @  s   € ÷ lñ lÐ)>ð lÀ3ñ lr%   c                ój   € \         P                  ! RV P                  RV P                  4       /RR7      # )zCBuild a synthetic role=tool content string for a blocked tool call.rÅ   Ú	guardrailF)r®   )r³   r´   r•   r�   )rù   s   &r#   Útoolguard_synthetic_resultr_  @  s,   € ä�:Š:�w × 0Ñ 0°+¸x×?SÑ?SÓ?UÐVÐejÔkÐkr%   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r¾   r   rù   r�   r   r!   )r"   s   "r#   r$   r$   E  s'   € ÷ jñ j cð jÐ5Jð jÈsñ jr%   c           
     óò   € VP                   R
9  g   VP                  '       g   V # VP                   R8X  d   RMRpT ;'       g    RRV RVP                   RVP                   RVP                   R	2	,           # )z;Append runtime guidance to the current tool result content.r¤   zTool loop hard stopzTool loop warningr”   z

[z: z; count=z; rÂ   >   r¤   rœ   )r’   r•   r“   r–   )r¾   rù   Úlabels   && r#   Úappend_toolguard_guidancerc  E  sr   € à‡�Ð.Ô.°h×6F×6FÐ6FØˆØ%-§_¡_¸Ô%>Ñ!ÐDW€EØ�LˆL�b˜e E 7¨"¨X¯]©]¨O¸8ÀHÇNÁNÐCSÐSUÐV^×VfÑVfÐUgÐghÐiÕiÐir%   c               ó$   € V ^8„  d   QhRRRRRR/# )r   r   r   r–   r7   r   r!   )r"   s   "r#   r$   r$   M  s!   € ÷ ñ ¨3ð °sð ¸sñ r%   c                óD   € V  RV R2pV R8X  d
   VR,           # VR,           # )zDAction-oriented guidance for recovering from repeated tool failures.z has failed zÁ times this turn. This looks like a loop. Do not switch to text-only replies; keep using tools, but diagnose before retrying. First inspect the latest error/output and verify your assumptions. rÀ   zÜFor terminal failures, run a small diagnostic such as `pwd && ls -la` in the same tool, then try an absolute path, a simpler command, a different working directory, or a different tool such as read_file/write_file/patch.zóTry different arguments, a narrower query/path, an absolute path when relevant, or a different tool that can make progress. If the blocker is external, report the blocker after one diagnostic attempt instead of repeating the same failing path.r!   )r   r–   Úcommons   && r#   r  r  M  sR   € ð ˆ+�\ % ð )Nð 	Nð ð
 �JÔØðYõ
ð 	
ð
 ð	_õð r%   c               ó    € V ^8„  d   QhRRRR/# )r   r–   r7   r   r   r!   )r"   s   "r#   r$   r$   a  s   € ÷ nñ n�Cð n˜Cñ nr%   c                ó‚   € T  ^V ^d,          u;8:  d   ^8:  d   M MR 2# ^R^R^R/P                  V ^
,          R4       2# )é   ÚthÚstÚndÚrd)rA   )r–   s   &r#   r'  r'  a  sP   € ØˆW˜R 5¨3¥;Ö4°"×4�TÐlÐmÐm¸1¸dÀAÀtÈQÐPTÐ:U×:YÑ:YÐZ_ÐbdÕZdÐfjÓ:kÐlÐmÐmr%   c               ó    € V ^8„  d   QhRRRR/# )r   r€   r<   r   r¸   r!   )r"   s   "r#   r$   r$   e  s   € ÷ 5ñ 5Ð/ð 5Ð4Eñ 5r%   c                ó6   € \        V \        4      '       d   V # / # rW   )r/   r	   r¼   s   &r#   rÿ   rÿ   e  s   € Ü˜d¤G×,Ò,ˆ4Ð4°"Ð4r%   c               ó    € V ^8„  d   QhRRRR/# )r   Úparsedr   r   r!   )r"   s   "r#   r$   r$   n  s   € ÷ ñ ¨3ð °3ñ r%   c                óT  € \        V \        4      '       g   V # V P                  4        UUu/ uF  w  rVR 8w  g   K  WbK  	  pppVP                  R4      p\        V\        4      '       d1   VP                  4        UUu/ uF  w  rVR8w  g   K  WbK  	  uppVR&   V# u uppi u uppi )Úduration_secondsÚkernelÚexecution_count)r/   rÆ   rr   rA   )rq  ÚkÚvÚcleanedrt  s   &    r#   Ú_without_execute_code_metadatary  n  s•   € Ü�fœd×#Ò#ØˆØ &§¡¤ÔJ¡™˜°!Ð7IÑ2IŒtˆqŠt¡€GÑJØ�[‰[˜Ó"€FÜ�&œ$×ÒØ.4¯l©l¬nÔW©n¡d aÀÐEVÑ@VœT˜QšT©nÒWˆ�ÑØ€Nùó	 Kùó Xs   ¬B¼BÁ?B$ÂB$c               ó$   € V ^8„  d   QhRRRRRR/# )r   r¾   r-   r   r   r   r!   )r"   s   "r#   r$   r$   x  s!   € ÷ ,ñ ,˜ð ,°ð ,¸Sñ ,r%   c                óª   € \        T ;'       g    R 4      pVf   \        T ;'       g    R 4      # VR8X  d   \        V4      p\        \        V4      4      # )r”   Úexecute_code)r
   rƒ   ry  r¶   )r¾   r   rq  s   && r#   r  r  x  sJ   € Ü˜VŸ\˜\ rÓ*€FØ‚~Ü�v—|�| Ó$Ð$Ø�NÔ"Ü/°Ó7ˆÜ”? 6Ó*Ó+Ð+r%   Fc               ó$   € V ^8„  d   QhRRRRRR/# )r   r¬   r   rB   r    r   r!   )r"   s   "r#   r$   r$   „  s!   € ÷ ñ �Cð  $ð ¨4ñ r%   c                óî   € \        V \        \        \        34      '       d   \        V 4      # \        V \        4      '       d3   \
        P                  V P                  4       P                  4       V4      # V# rW   )	r/   r    r7   Úfloatr   Ú_BOOL_WORDSrA   r0   r1   )r¬   rB   s   &&r#   rq   rq   „  sR   € Ü�%œ$¤¤UÐ+×,Ò,Ü�E‹{ÐÜ�%œ×ÒÜ�‰˜uŸ{™{›}×2Ñ2Ó4°gÓ>Ð>Ø€Nr%   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r¬   r   rB   r7   Úminimumr   r!   )r"   s   "r#   r$   r$   Œ  s(   € ÷ 4ñ 4˜ð 4 sð 4°Sð 4¸Sñ 4r%   c                ó`   €  \        V 4      pY28¼  d   T# T#   \        \        3 d    Tu # i ; i)zRjunk/None/below-minimum fall back to default (caps use minimum 0 so 0 = disabled).)r7   rº   Ú
ValueError)r¬   rB   r‚  rq  s   &&& r#   r@   r@   Œ  s=   € ðÜ�U“ˆð Ô&ˆ6Ð3¨GÐ3øô ”zÐ"ô ØŠðús   ‚ —-¬-c               ó    € V ^8„  d   QhRRRR/# )r   r€   r¸   r   r7   r!   )r"   s   "r#   r$   r$   •  s   € ÷ Bñ BÐ 1ð B°cñ Br%   c                ó  € \        V P                  R4      ;'       g    R4      P                  4       P                  4       R9   d   ^ # V P                  R4      p\	        V\
        4      '       d   V'       d   \        V4      # ^# )ziSubagents one delegate_task call spawns: ``len(tasks)`` for a non-empty batch, else 1; control actions 0.r’   r”   Útasks)ÚlistÚsteerÚstop)r   rA   r0   r1   r/   rˆ  r+  )r€   r‡  s   & r#   rU  rU  •  sa   € ä
ˆ4�8‰8�HÓ×#Ð# Ó$×*Ñ*Ó,×2Ñ2Ó4Ð8QÔQÙØ�H‰H�WÓ€EÜ# E¬4×0Ò0·UŒ3ˆu‹:ÐAÀÐAr%   c               ó    € V ^8„  d   QhRRRR/# )r   r¬   r   r   r!   )r"   s   "r#   r$   r$   �  s   € ÷ Nñ N�3ð N˜3ñ Nr%   c                ój   € \         P                  ! V P                  R R4      4      P                  4       # )zutf-8Úsurrogatepass)ÚhashlibÚsha256ÚencodeÚ	hexdigestrµ   s   &r#   rƒ   rƒ   �  s'   € ô �>Š>˜%Ÿ,™, w°Ó@ÓA×KÑKÓMÐMr%   >   Ú	read_fileÚ
skill_viewr   Úskills_listÚweb_extractÚsearch_filesÚsession_searchÚbrowser_consoleÚbrowser_snapshotÚbrowser_get_imagesÚmcp_filesystem_read_fileÚmcp_filesystem_search_filesÚmcp_filesystem_get_file_infoÚmcp_filesystem_directory_treeÚmcp_filesystem_list_directoryÚmcp_filesystem_read_text_fileÚ"mcp_filesystem_read_multiple_filesÚ(mcp_filesystem_list_directory_with_sizes>   ÚpatchrÄ   rÀ   Ú	todo_listÚ
write_fileÚbrowser_typer|  Úsend_messageÚskill_manageÚbrowser_clickÚbrowser_pressr   Úbrowser_scrollÚcronjob_manager   Úbrowser_navigate)Ú_get_resultÚ_poll>   ÚprocessrÀ   r•  r|  r   r­  >   Útodor£  rÄ   Úcronjobr°  rÀ   r¤  r¥  r¦  r|  r§  r¨  r©  rª  r   r¬  r   r­  )rS   rT   rU   )Ú
warn_afterÚexact_failure)r³  Úsame_tool_failure)r³  Úidempotent_no_progress)Úhard_stop_afterr´  )r·  rµ  )r·  r¶  >   ÚacpÚcliÚtuiÚdesktopÚsubagentÚ
api_server)r8   rî   rÑ   )r9   rï   rÒ   )r”   )Ú1ÚtrueÚyesÚonÚenabled)Ú0ÚfalseÚnoÚoffÚdisabled)EÚ__conditional_annotations__rK   Ú
__future__r   rŽ  r³   Úcollectionsr   Údataclassesr   r   r   r   Útypingr   r	   Úutilsr
   Ú agent.tool_result_classificationr   r   r   r   r   Ú	frozensetrX   r^   r'   r)   r%  r?  rë   r,  rL  r  r  rp   r   rM   rL   rN   r2   r*   r3   r6   rR   rx   r}   r�   r¶   r„   rÉ   rÓ   r&  r*  rÔ   rÖ   r_  rc  r  r'  rÿ   ry  r  r€  rq   r@   rU  rƒ   )ÚwrÈ  s   0@r#   Ú<module>rÑ     s  øðôõ #ã Û Ý ß 8Ó 8ß å !÷qõ qñ "ò #ó Ð ñ  ò !ó Ð ñ  )Ð*:Ð);Ó<Ð Ø#;Ð  à'(Ð $ð !"Ð àÐ ð #&Ð Ø"%Ð ñ
 (ò )ó Ð ñ &ò 'ó Ð ð ^€ð Ð ?Ø"Ð$GØÐFØÐ!EØ"Ð$LØÐLð2Ð Ð.ó ð &(Ð "Ø"$Ð ñ  Ò ZÓ[Ð õmõ
?ñ �$Ô÷cð có ðcñ �$Ô÷#gð #gó ð#gñL �$Ô÷ð ó ðñ �$Ô÷ð ó ðñ �$Ô÷ð ó ðõ2eõ!õMðB #ð	Nð #ð	að ð	Tð %ð	Rð %ð	Að !ð	sð ð	Ið ð	wð ð	tðG&&Ð �Nó &ðR#ð ð#ð ð ÐWØÐSð/€
Ð+ó ÷Eñ EõPlõ
jõõ(nõ5õ÷,ñ !FÓFÑ E˜1�$ŠwÑ EÑFñ  ]Dó  JEñ  ]DÐWXÈUÊ(ñ  ]Dñ  JEõ  E€õõ4õB÷Nùò9 Gùò  JEs   ÆGÆ"G