+
    lHàjñM  ã                  óî  € R t ^ RIH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HtHtHt ]P,                  ! R4      t]P0                  ! R4      t] ! R	 R
4      4       tR R ltR R ltR R ltR R ltR R ltR R lt ]PB                  R R l4       t"R R lt#R R lt$R R lt%R R  lt&R! R" lt'R# R$ lt(R1R% R& llt)R' R( lt*R) R* lt+R+ R, lt,R- R. lt-R/ R0 lt.R# )2a%  Per-task child routes from the active delegation provider (``delegation.backend``).

``delegate_task`` asks the active :class:`agent.delegation_provider.DelegationProvider` for one
route per task, validates the model's provider-declared parameters, turns each route into the
credential bundle child construction already consumes (the same resolver ``delegation.*`` uses),
and binds a profile route's scope around the child's construction and conversation. The provider
never touches the lifecycle; this module is the whole contract between the two.
)ÚannotationsN)Ú	dataclassÚreplace)ÚPath)ÚAnyÚIteratorÚMappingÚOptional)ÚRESERVED_TASK_PARAMETERSÚ
ROUTE_KEYSÚDelegationProviderÚDelegationRouteErrorztools.delegate_toolz^[a-z][a-z0-9_]{0,63}$c                  óŽ   € ] tR t^t$ RtR]R&   R]R&   RtR]R&   RtR]R	&   RtR
]R&   Rt	R]R&   Rt
R
]R&   R R ltR R ltRtR# )Ú	TaskRoutea<  How core builds one child: the credential bundle (with a route's speed tier applied), the config block
owning its fallback policy, an optional reasoning override, and the profile home it runs as (None = this one).
``error`` set = the backend could not route this task: it is refused alone and its siblings still run.údict[str, Any]ÚcredsÚrouting_cfgNr   Úreasoning_effortzOptional[Path]Úprofile_homeúOptional[str]ÚlabelÚdefaultÚstrÚbackendÚerrorc               ó   € V ^8„  d   QhRR/# )é   ÚreturnzOptional[dict[str, Any]]© )Úformats   "Ú?/home/ubuntu/.hermes/hermes-agent/tools/delegate_tool_routes.pyÚ__annotate__ÚTaskRoute.__annotate__+   s   € ÷ Zñ ZÐ0ñ Zó    c                ó®   € V P                   R8X  d   V P                  '       g   R# RV P                   /V P                  '       d   RV P                  /C# / C# )zgThe ``route`` a backend-routed task's result carries (None for the default backend's unlabelled route).r   Nr   r   )r   r   )Úselfs   &r    ÚreportÚTaskRoute.report+   sG   € à�<‰<˜9Ô$¨T¯Z¯Z¨ZÙØ˜4Ÿ<™<ÐYÀTÇZÇZÀZ¨W°d·j±jÐ,AÐYÐYÐUWÐYÐYr#   c               ó    € V ^8„  d   QhRRRR/# )r   ÚindexÚintr   r   r   )r   s   "r    r!   r"   1   s   € ÷ sñ s 3ð s¨>ñ sr#   c                óŠ   € RTRRRRRV P                   R^ R^ R/ V P                  4       ;'       g    R	V P                  /CR
R/C/# )zFResult entry for a task this route refused: no child was built for it.Ú
task_indexÚstatusr   ÚsummaryNÚ	api_callsÚduration_secondsÚrouter   ÚrefusedT)r   r&   r   )r%   r)   s   &&r    Úrefused_entryÚTaskRoute.refused_entry1   s^   € à˜e X¨w¸	À4ÈÐRV×R\ÑR\Ð^iÐklØ" A wÐ0q°D·K±K³M×4^Ð4^ÀiÐQU×Q]ÑQ]ÐE^Ð0qÐajÐlpÑ0qðsð 	sr#   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotations__r   r   r   r   r   r&   r3   Ú__static_attributes__r   r#   r    r   r      s[   ‡ ñnð ÓØÓØ Ð�cÓ Ø#'€L�.Ó'Ø€Eˆ=ÓØ€GˆSÓØ€Eˆ=ÓõZ÷sñ sr#   r   c               ó    € V ^8„  d   QhRRRR/# )r   ÚconfigúMapping[str, Any]r   r   r   )r   s   "r    r!   r!   7   s   € ÷ 'ñ 'Ð.ð 'Ð3Eñ 'r#   c                ó   € ^ RI Hp V! V 4      # )é    )Úget_active_provider)Úagent.delegation_registryrA   )r=   rA   s   & r    Ú_active_providerrC   7   s   € Ý=Ù˜vÓ&Ð&r#   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úproviderr   r=   r>   r   údict[str, dict[str, Any]]r   )r   s   "r    r!   r!   <   s$   € ÷ ñ Ð#5ð Ð?Pð ÐUnñ r#   c                ó@  €  V P                  V4      p\        T\        4      '       g   / # / pTP                  4        F¨  w  rE\        T\        4      '       d'   \        P                  T4      '       d   T\        9   d$   \        P                  RT P                  T4       Kd  \        T\        4      '       g   K|  \        P                  ! \        P                  ! T4      4      Y4&   Kª  	  T#   \         d(    \        P                  RT P                  RR7       / u # i ; i)zRThe provider's per-task parameters, minus anything malformed or reserved (warned).zDdelegation provider %s.task_parameters() raised; no extra parametersT©Úexc_infozLdelegation provider %s: task parameter %r refused (reserved or invalid name))Útask_parametersÚ	ExceptionÚloggerÚwarningÚnameÚ
isinstancer   Úitemsr   Ú_PARAM_NAME_REÚmatchr
   ÚjsonÚloadsÚdumps)rE   r=   ÚrawÚacceptedrN   Úschemas   &&    r    Ú_declared_parametersrY   <   så   € ðØ×&Ñ& vÓ.ˆô
 �cœ7×#Ò#Øˆ	Ø*,€HØŸ	™	ž‰ˆÜ˜$¤×$Ò$¬N×,@Ñ,@À×,FÒ,FÈ$ÔRjÔJjÜ�N‰NÐiØ#Ÿ=™=¨$ô0áÜ�fœg×&Ô&Ü!ŸZšZ¬¯
ª
°6Ó(:Ó;ˆH‹Nñ $ð €Oøô ô Ü�‰Ð]Ð_g×_lÑ_lØ $ð 	ô 	&àŠ	ðús   ‚C+ Ã+/DÄDc               ó    € V ^8„  d   QhRRRR/# )r   r=   r>   r   z%tuple[dict[str, dict[str, Any]], str]r   )r   s   "r    r!   r!   Q   s    € ÷ iñ iÐ.ð iÐ3Xñ ir#   c                ó:  €  \        V 4      p TP                  T 4      p\        Y4      \        T\        4      '       d   TP                  4       3# R3#   \         d    / R3u # i ; i  \         d(    \        P                  RTP                  RR7       Rp Lzi ; i)zˆ``(extra task properties, description addendum)`` for the active provider (none for the
default strategy, whose schema is the base one).Ú z+delegation provider %s.description() raisedTrH   )rC   r   ÚdescriptionrK   rL   rM   rN   rY   rO   r   Ústrip)r=   rE   Úaddendums   &  r    Úschema_extensionr`   Q   s�   € ðÜ# FÓ+ˆðØ×'Ñ'¨Ó/ˆô   Ó1ÄzÐRZÔ\_×G`ÒG`°8·>±>Ó3CÐhÐhÐfhÐhÐhøô  ô Ø�2ˆvŠðûô ô Ü�‰ÐDÀhÇmÁmÐ^bˆÔcØŠðús"   ‚A ŽA( ÁA%Á$A%Á(/BÂBc          
     ó,   € V ^8„  d   QhRRRRRRRRR	R
/# )r   r)   r*   rN   r   Úvaluer   rX   r>   r   r   r   )r   s   "r    r!   r!   `   s1   € ÷ ñ ˜ð  3ð ¨sð Ð<Mð ÐR_ñ r#   c                óº   € VP                  R 4      p\        V\        4      '       d4   W$9  d.   RV  RV RRP                  \	        \
        V4      4       RV: R2	# R# )ÚenumúTask z: 'z' must be one of ú, z (got z).N)ÚgetrO   ÚlistÚjoinÚmapr   )r)   rN   rb   rX   rd   s   &&&& r    Ú_param_errorrk   `   s[   € Ø�:‰:�fÓ€DÜ�$œ×Ò %Ô"3Ø�u�g˜S  Ð&7¸¿	¹	Ä#ÄcÈ4Ã.Ó8QÐ7RÐRXÐY^ÑXaÐacÐdÐdÙr#   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úprovider_namer   r1   r   r   r   r   )r   s   "r    r!   r!   g   s!   € ÷ ?ñ ? ð ?¨Cð ?°Nñ ?r#   c                óº   € \        V\        4      '       g   \        RV  R24      hVP                  4        UUu/ uF  w  r#V\        9   g   K  W#bK  	  upp# u uppi )z¾The route keys of a provider's answer. Other keys are dropped silently: returning the whole
``delegation`` section (``dict(config)``, the default route) legitimately carries lifecycle knobs.zdelegation backend 'z' returned no route.)rO   r   r   rP   r   )rm   r1   ÚkÚvs   &&  r    Ú_clean_routerq   g   sQ   € ô �eœW×%Ò%Ü"Ð%9¸-¸ÐH\Ð#]Ó^Ð^Ø"Ÿ[™[œ]Ô>™]‘T�Q¨a´:©oŒDˆAŠD™]Ò>Ð>ùÓ>s   ¹AÁAc               ó    € V ^8„  d   QhRRRR/# )r   rN   r   r   r   r   )r   s   "r    r!   r!   o   s   € ÷ 'ñ '˜ð ' ñ 'r#   c                óÈ   € ^ RI HpHp \        V \        4      '       d%   V P                  4       '       d   V! V 4      '       g   \        RV : R24      h\        V! V 4      4      # )r@   )Úget_profile_dirÚprofile_existszProfile z, does not exist (see `hermes profile list`).)Úhermes_cli.profilesrt   ru   rO   r   r^   r   r   )rN   rt   ru   s   &  r    Ú_profile_homerw   o   sK   € ßCÜ�dœC× Ò ¨¯
©
¯ª¹NÈ4×<PÒ<PÜ" X¨d©XÐ5aÐ#bÓcÐcÜ‘ Ó%Ó&Ð&r#   c               ó    € V ^8„  d   QhRRRR/# )r   Úhomer   r   zIterator[None]r   )r   s   "r    r!   r!   w   s   € ÷ ñ  #ð ¨.ñ r#   c              #  óš  "  € ^ RI HpHpHp \	        V \
        \        34      '       d   V! V 4      V! V! 4       4      8X  d   Rx € R# ^ RIHpH	pH
pHp ^ RIHp ^ RI Hp	Hp
 ^ RIHpHp ^ RIHp V! V 4      V! V! 4       4      8g  pV! V 4       \*        P,                  ! 4       ;_uu_ 4       pVP/                  Wš! \        V 4      4      4       VP/                  WW! V! V 4      \        V 4      R7      4       V'       d   VP/                  WF! R	4      4       VP/                  WË! V 4      4       Rx € RRR4       R#   + '       g   i     R# ; i5i)
up  Run the block as profile ``home``: HERMES_HOME override, that profile's secret scope,
multiplex semantics when it is not this process's own profile, and its terminal policy - the
binding a multiplexed gateway applies to a routed turn (gateway/AGENTS.md Â§ Profile scope).
A no-op for anything but a path (``None``: no profile route) and for the home already in effect.)Úget_hermes_homeÚget_routing_process_hermes_homeÚhermes_home_keyN)Úreset_multiplex_contextÚreset_secret_scopeÚset_multiplex_contextÚset_secret_scope)Úhydrate_profile_secret_sources)Úreset_hermes_home_overrideÚset_hermes_home_override)Úinstall_profile_terminal_scopeÚreset_terminal_scope)Úowner_secret_scope)r   T)Úhermes_constantsr{   r|   r}   rO   r   r   Úagent.secret_scoper~   r   r€   r�   Úhermes_cli.env_loaderr‚   rƒ   r„   Útools.terminal_scoper…   r†   Ú!tui_gateway.launch_profile_policyr‡   Ú
contextlibÚ	ExitStackÚcallback)ry   r{   r|   r}   r~   r   r€   r�   r‚   rƒ   r„   r…   r†   r‡   ÚroutedÚstacks   &               r    Údelegated_profile_scoper’   v   s  é € ÷ cÑbÜ�dœS¤$˜K×(Ò(©O¸DÓ,AÁ_ÑUdÓUfÓEgÔ,gÛÙ÷ó õ EßUßYÝDá˜TÓ"¡oÑ6UÓ6WÓ&XÑX€FÙ" 4Ô(ô 
×	Ò	×	Ô	 5Ø�‰Ð1Ð3KÌCÐPTËIÓ3VÔWØ�‰Ð)Ð+;Ñ<NÈtÓ<TÔcfÐgkÓclÔ+mÔnßØ�N‰NÐ2Ð4IÈ$Ó4OÔPØ�‰Ð+Ð-KÈDÓ-QÔRÛ÷ 
 ×	×	Ò	üs   ‚B(EÂ*BD7Ä-
EÄ7E	Å	Ec               ó    € V ^8„  d   QhRRRR/# )r   Úchildr   r   z!contextlib.AbstractContextManagerr   )r   s   "r    r!   r!   •   s   € ÷ Sñ S˜sð SÐ'Hñ Sr#   c                ó.   € \        \        V RR4      4      # )a  The profile scope a built child's own work runs in (its startup credential lease, every conversation turn
incl. the output_schema retry); a no-op for children without a profile route. Parent bookkeeping (registry,
heartbeat, progress, result assembly) stays outside it.Ú_delegate_profile_homeN)r’   Úgetattr)r”   s   &r    Úchild_profile_scoper˜   •   s   € ô #¤7¨5Ð2JÈDÓ#QÓRÐRr#   c               ó    € V ^8„  d   QhRRRR/# )r   Úcfgr>   r   r   r   )r   s   "r    r!   r!   œ   s   € ÷ ñ Ð 1ð °nñ r#   c           	     óò  € ^ RI Hp V P                  R4      p\        V\        4      '       d^   VP                  R4      ;'       g    VP                  R4      p\        VP                  R4      ;'       g    R4      P                  4       pM\        V\
        4      '       d   TMRRrCRT;'       g    R/p\        V\
        4      '       d   VP                  4       '       g   V# V! W4P                  4       V P                  R4      V P                  R	4      \	        V 4      R
7      pVeQ   RVP                  RVP                  ;'       g    RRVP                  ;'       g    RRVP                  ;'       g    R/pV# )zÕ``resolve_runtime_provider`` kwargs for a profile's primary model, decoded by the same owner CLI startup
uses (``resolve_startup_model_route``): a ``model.default`` alias takes the alias's model, endpoint and key.)Úresolve_startup_model_routeÚmodelr   rE   r\   NÚtarget_modelÚ	providersÚcustom_providers)Úcurrent_providerÚuser_providersr    Úalias_configÚ	requestedÚexplicit_base_urlÚexplicit_api_key)Úhermes_cli.model_switchrœ   rg   rO   Údictr   r^   Úlowerr�   rE   Úbase_urlÚapi_key)rš   rœ   Ú	model_cfgr�   Úcfg_providerÚrequestÚstartups   &      r    Ú_profile_model_requestr°   œ   s6  € õ DØ—‘˜Ó €IÜ�)œT×"Ò"Ø—‘˜iÓ(×BÐB¨I¯M©M¸'Ó,BˆÜ˜9Ÿ=™=¨Ó4×:Ð:¸Ó;×AÑAÓC‰ä,6°yÄ#×,FÒ,F™yÈDÐSUˆ|Ø-¨u¯}¨}¸Ð=€GÜ�eœS×!Ò!¨¯©¯ªØˆÙ)Ø× 2Ñ 2Ó 4ÀSÇWÁWÈ[ÓEYØŸ™Ð!3Ó4Ä4ÈÃ9ôN€Gð ÒØ! 7§=¡=°+¸w×?OÑ?O×?WÐ?WÐSWØ&¨×(8Ñ(8×(@Ð(@¸DÐBTÐV]×VeÑVe×VmÐVmÐimðoˆà€Nr#   c               ó    € V ^8„  d   QhRRRR/# )r   ry   r   r   ÚNoner   )r   s   "r    r!   r!   ²   s   € ÷ 	Qñ 	Q¨ð 	Q°ñ 	Qr#   c                ó†   € ^ RI Hp ^ RIHpHp V! 4       e*   V! V 4      V! V! 4       4      8w  d   \        RV  R24      hR# R# )a;  A managed worker (kanban, safe mode, managed sessions) runs on the session config frozen at creation:
every config reader returns that snapshot and the process never opens profile files, so another profile's
config.yaml is unreachable here. Refuse rather than pair the launch profile's model with the target's keys.)Úworker_config_snapshot)r{   r}   Nz|Profile routes are unavailable in a managed worker session (its config is frozen at creation): cannot run as the profile at z. Delegate without a profile.)Úagent.safe_worker_policyr´   rˆ   r{   r}   r   )ry   r´   r{   r}   s   &   r    Ú_refuse_under_worker_snapshotr¶   ²   sT   € õ @ßAÙÓÒ+±ÀÓ0EÉÑYhÓYjÓIkÔ0kÜ"ð,Ø,0¨6Ð1NðPóQð 	Qñ 1lÑ+r#   c               ó    € V ^8„  d   QhRRRR/# )r   ry   r   r   r   r   )r   s   "r    r!   r!   ¾   s   € ÷ Zñ Z˜ð Z )ñ Zr#   c                óª  € ^ RI Hp ^ RIHp ^ RIHp ^ RIHpHpH	p \        V 4       \        V 4      ;_uu_ 4        V! 4       ;'       g    / p\        V4      p V! R/ VB p	TR,          ;'       g    T	P                  R	4      ;'       g    RpTP                  R
4      pRRR4       \!        X	P                  R4      ;'       g    R4      P#                  4       pT	P                  R4      R8X  d   TP%                  4       R9  d   TMT	P                  R4      pT! T	P                  R4      RT  RT	P                  R4       R24       T! XYéP                  R4      T	P                  R4      ;'       g    RT	P                  R4      \'        T	P                  R4      ;'       g    / 4      T	P                  R4      \)        T	P                  R4      ;'       g    . 4      R7      p\+        TR
\-        X\(        4      '       d   TM. /T! T! XT;'       g    R4      4      T 4      #   \         d   p
\        RT  RT
 24      T
hRp
?
ii ; i  + '       g   i     EL¬; i)zµThe profile's own primary route, resolved inside its scope (its config.yaml + secrets). The
child never borrows the launching profile's key, pool, fallback chain or reasoning level.)Úload_config_readonly)Úresolve_runtime_provider)Úresolve_reasoning_config)ÚResolvedReasoningÚ_credential_bundleÚ_require_pinned_commandzProfile at z has no usable model provider: Nrž   r�   Úfallback_providersÚrequested_providerr\   rE   ÚcustomÚcommandz is pinned to the 'zP' command, which was not found on PATH. Install it or route this task elsewhere.rª   r«   zno-key-requiredÚapi_modeÚrequest_overridesÚargs)rÂ   rÅ   r   )r\   Úauto)Úhermes_cli.configr¹   Úhermes_cli.runtime_providerrº   rˆ   r»   Útools.delegate_tool_configr¼   r½   r¾   r¶   r’   r°   rK   r   rg   r   r^   r©   r¨   rh   r   rO   )ry   r¹   rº   r»   r¼   r½   r¾   rš   r®   ÚrtÚexcr�   Úfallbackr¤   rE   r   s   &               r    Ú_profile_routerÍ   ¾   s  € õ 7ÝDÝ9ßiÑiÜ! $Ô'Ü	  ×	&Õ	&Ù"Ó$×*Ð*¨ˆÜ(¨Ó-ˆð	jÙ)Ñ4¨GÑ4ˆBð ˜Õ'×BÐB¨2¯6©6°'«?×BÐB¸dˆØ—7‘7Ð/Ó0ˆ÷ 
'ô �B—F‘FÐ/Ó0×6Ð6°BÓ7×=Ñ=Ó?€IØŸF™F :Ó.°(Ô:¸y¿¹Ó?PÐXdÔ?d‰yÐjl×jpÑjpÐq{Ój|€HáØ
�‰ˆyÓ˜[¨¨Ð.AÀ"Ç&Á&ÈÓBSÐATð UBð CôDñ ØˆxŸ™ 
Ó+Ø
�‰ˆyÓ×.Ð.Ð.°·±°zÓ0BÄDÈÏÉÐPcÓId×IjÐIjÐhjÓDkØ—‘�yÓ!¬¨R¯V©V°F«^×-AÐ-A¸rÓ(Bô€Eô
 �UÐ1¼zÈ(ÔTX×?YÒ?Y±8Ð_aÐbÙ&Ñ'?ÀÀUÇ[À[ÈbÓ'QÓRÐTXóZð Zøô# ô 	jÜ&¨°T°FÐ:YÐZ]ÐY^Ð'_Ó`ÐfiÐiûð	jú÷ 
'×	&Ð	&ús;   »IÁHÁ!IÁ1IÂ
IÈH>È'H9È9H>È>IÉI	c               ó$   € V ^8„  d   QhRRRRRR/# )r   r1   r   r=   r>   r   r   )r   s   "r    r!   r!   à   s(   € ÷ Vñ V Nð VÐ<Mð VÐR`ñ Vr#   c                ó˜   € V P                  R4      '       g   V P                  R4      e   V # VP                  R4      pVf   V # / V CRV/C# )z½A route without a fallback chain of its own takes ``delegation.fallback_providers`` (an explicit ``[]`` on the
route still disables fallback). A profile route keeps its profile's own chain.Úprofiler¿   )rg   )r1   r=   Ú	inheriteds   && r    Ú_with_inherited_fallbackrÒ   à   sT   € ð ‡y�y�×Ò˜uŸy™yÐ)=Ó>ÒJØˆØ—
‘
Ð/Ó0€IØÒ%ˆ5ÐUÐ+U¨eÐ+UÐ5IÈ9Ñ+UÐUr#   c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   r1   r   Úparent_agentr   r   r   r   r   r   )r   s   "r    r!   r!   é   s.   € ÷ Wñ W˜.ð W¸ð WÀcð WÈiñ Wr#   c                óF  € V P                  R 4      '       d'   \        \        \        V R ,          4      4      VR7      # ^ RIHp V! W4      pV P                  R4      R9  d$   ^ RIHp / VCV! \        V R,          4      WA4      Cp\        W@V P                  R4      RRV4      # )rÐ   )r   ©Ú_resolve_delegation_credentialsÚservice_tierN)Útask_service_tierr   ©Nr\   )
rg   r   rÍ   rw   Útools.delegate_toolr×   Útools.delegate_tool_tuningrÙ   r   r   )r1   rÔ   r   r×   r   rÙ   s   &&&   r    Ú_resolve_routerÝ   é   s�   € Ø‡y�y�×ÒÜ”~¤m°E¸)Õ4DÓ&EÓFÐPWÔXÐXÝCÙ+¨EÓ@€EØ‡y�y�Ó ¨
Ô2Ý@Ø_�5Ð_Ñ-¬c°%¸Õ2GÓ.HÈ%Ó^Ð_ˆÜ�U 5§9¡9Ð-?Ó#@À$ÈÈgÓVÐVr#   c               ó0   € V ^8„  d   QhRRRRRRRRR	R
RR/# )r   r1   r   rÔ   r   Úcachezdict[str, TaskRoute]r=   zOptional[Mapping[str, Any]]r   r   r   r   r   )r   s   "r    r!   r!   ô   s:   € ÷ ,ñ , ð ,¸cð ,ÐJ^ð ,Ø!<ð,ØNQð,Øbkñ,r#   c                ó†  € \        V P                  R 4      \        4      '       d   V P                  R 4      MRp\        Y;'       g    / 4      p \        P
                  ! V P                  4        UUu/ uF  w  rgVR 8w  g   K  WgbK  	  uppR\        R7      pW‚9  d   \        WV4      W(&   \        W(,          VR7      # u uppi )r   NT)Ú	sort_keysr   )r   )	rO   rg   r   rÒ   rS   rU   rP   rÝ   r   )	r1   rÔ   rß   r=   r   r   ro   rp   Úkeys	   &&&&&    r    Ú_route_to_task_routerã   ô   s•   € ä",¨U¯Y©Y°wÓ-?Ä×"EÒ"EˆE�I‰I�gÔÈ4€EÜ$ U¯L¨L°bÓ9€Eä
�*Š* u§{¡{¤}ÔE¡}™t˜q¸¸W¹”d�a’d¡}ÒEÐQUÔ_bÔ
c€CØ
ÔÜ# E¸ÓAˆ‰
Ü�5•: UÔ+Ð+ùó Fs   Á1B=
ÂB=
c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r)   r*   r1   r>   r=   r   r²   r   )r   s   "r    r!   r!   ÿ   s1   € ÷ 
Jñ 
J ð 
JÐ->ð 
JÐHYð 
JÐ^bñ 
Jr#   c           
     ó   € VP                  R4      pVP                  R4      '       g   VR
9   g   W2P                  R4      8X  d   R# ^ RIHpHp V! V4      f&   \	        RV  RV: RRP                  V4       R	24      hR# )z×A backend's ``reasoning_effort`` must be a known level: a typo is a tool error, never the parent's level.
The ``delegation`` section's own value (the default route, ``dict(config)``) keeps its warn-and-inherit rule.r   rÐ   N)ÚVALID_REASONING_EFFORTSÚparse_reasoning_effortre   z: unknown reasoning_effort z$ on this route. Use none or one of: rf   Ú.rÚ   )rg   rˆ   ræ   rç   r   ri   )r)   r1   r=   Úeffortræ   rç   s   &&&   r    Ú_check_backend_effortrê   ÿ   s‰   € ð �Y‰YÐ)Ó*€FØ‡y�y�×Ò˜v¨Ô3°vÇÁÐL^ÓA_Ô7_ÙßPÙ˜fÓ%Ò-Ü"Ø�E�7Ð5°f±Zð @#Ø#'§9¡9Ð-DÓ#EÐ"FÀaðIóJð 	Jñ .r#   c               ó0   € V ^8„  d   QhRRRRRRRRR	R
RR
/# )r   rE   r   r)   r*   Únamesz	list[str]r=   r>   Úsavedr   r   r   )r   s   "r    r!   r!     sB   € ÷ Wñ WÐ 2ð W¸3ð WÀyð WÐZkð WØ ðWØ%(ñWr#   c                ó8  € ^ RI Hp V P                  pRP                  R V 4       4      p\	        VP                  4        Uu0 uFM  qˆP                  V8w  g   K  \        V4      \        \        Wƒ4      4      ,          '       g   KA  VP                  kKO  	  up4      p	RV RV RV 2p
WF8X  d   RV R2pMR	V R
V RV R2pV	'       dB   RP                  R V	 4       4      pV
 RV RV^ ,          P                  4        VR,           R2# V
 RV RV RV R2# u upi )a£  Why a task carrying parameters the session's backend does not declare is refused. The schema follows
config.yaml for the whole session (cached prompt), so after a ``/delegation`` switch the model can still send
the previous backend's parameters; dropping them would run the task on this backend's default route.
``/new`` starts on the saved backend (``saved``), so the fix persists the session's pick first or names it.)Ú	_registryrf   c              3  ó.   "  € T F  pR V R 2x € K  	  R# 5i©Ú'Nr   )Ú.0rN   s   & r    Ú	<genexpr>Ú$_undeclared_error.<locals>.<genexpr>  s   é € Ð5©u t˜˜4˜& •{«uùó   ‚re   z(: this session's delegation backend is 'z', which does not take zDstart a new session with /new for delegate_task choices that match 'rò   zrun `/delegation zH --global` then `/new` for a session whose delegate_task choices match 'z', or `/delegation z2` to switch this session back to the saved backendc              3  ó.   "  € T F  pR V R 2x € K  	  R# 5irñ   r   )ró   Úowners   & r    rô   rõ     s   é € Ð<±V¨E˜Q˜u˜g Q�<³Vùrö   z (declared by z!), so this task was not started. :é   NNrè   z\, and no installed delegation backend does, so this task was not started. Resend it without z.; if this session's delegate_task tool offers )	rB   rï   rN   ri   ÚsortedÚlist_providersÚsetrY   Úupper)rE   r)   rì   r=   rí   rï   ÚactiveÚlistedÚotherÚownersÚheadÚfixÚquoteds   &&&&&        r    Ú_undeclared_errorr    sN  € õ 4Ø�]‰]€FØ�Y‰YÑ5©uÓ5Ó5€FÜ¨Y×-EÑ-EÔ-Gó PÑ-G EÏ:É:ÐY_ÑK_”ZÜ˜U›¤cÔ*>¸uÓ*MÓ&N×NÑNô  �U—Z”ZÑ-Gñ Pó Q€Fà�5�'ÐAÀ&ÀÐI`ÐagÐ`hÐi€DØ„ØTÐU[ÐT\Ð\]Ð^‰à" 6 (ð +Ø�(Ð-¨e¨WÐ4fðhˆçØ—‘Ñ<±VÓ<Ó<ˆØ��~ f XÐ-NÈsÐSTÍvÏ|É|Ë~ÐN^Ð_bÐceÕ_fÐ^gÐghÐiÐiØˆfÐpØˆhÐDÀVÀHÈBÈsÈeÐSTðVð WùòPs   ÁDÁ'DÂDc               ó4   € V ^8„  d   QhRRRRRRRRR	RR
RRR/# )r   rE   r   ÚdeclaredrF   r)   r*   Útaskr>   r=   rí   r   r   r   r   )r   s   "r    r!   r!   $  sM   € ÷ qñ qÐ+ð qÐ7Pð qÐY\ð qØ&ðqØ0AðqØJMðqØR`ñqr#   c           	     óì  a€ \        V3R  lVP                  4        4       4      pV'       d   \        \        WWdV4      4      hS Uu/ uF   qsP	                  V4      f   K  WsV,          bK"  	  ppVP                  4        F,  w  ry\        W'V	SV,          4      p
V
'       g   K#  \        V
4      h	  RVP	                  R4      RVP	                  R4      RV/VCp \        V P                  V P                  W´4      4      # u upi   \         d   p\        RT RT 24      ThRp?i\         dG   p\        P                  RT P                  RR	7       \        RT R
T P                   RT 24      ThRp?ii ; i)c              3  ód   <"  € T F%  w  rVf   K  VS9  g   K  V\         9  g   K!  Vx € K'  	  R # 5i)N)r
   )ró   rN   rb   r  s   &  €r    rô   Ú_route_one.<locals>.<genexpr>&  s9   øé € ð p±¡ Ø ô Ø15¸XÑ1Eô ØJNÔVnÑJn÷ š³ùs   ƒ0�0™0¦
0NÚgoalÚcontextr)   re   z: z*delegation provider %s.route_task() raisedTrH   z: delegation backend 'z
' failed: )rú   rP   r   r  rg   rk   rq   rN   Ú
route_taskrK   rL   rM   )rE   r  r)   r  r=   rí   Ú
undeclaredrN   Úparamsrb   r   ÚpayloadrË   s   &f&&&&       r    Ú
_route_oner  $  sc  ø€ äô p°·
±
´ó pó p€JçÜ"Ô#4°XÀjÐZ_Ó#`ÓaÐaÙ+3ÓR©8 4·x±xÀ³~Ôˆd˜•JÒ©8€FÐRØ—|‘|–~‰ˆÜ˜U¨%°¸$µÓ@ˆß‰5Ü& uÓ-Ð-ñ &ð �t—x‘x Ó'¨°D·H±H¸YÓ4GÈÐRWÐbÐ[aÐb€GðqÜ˜HŸM™M¨8×+>Ñ+>¸wÓ+OÓPÐPùò Søô  ô DÜ" U¨5¨'°°C°5Ð#9Ó:ÀÐCûÜô qÜ�‰ÐCÀXÇ]Á]Ð]aˆÔbÜ" U¨5¨'Ð1GÈÏÉÀÐV`ÐadÐ`eÐ#fÓgÐmpÐpûðqús7   ÁC=Á C=Ã$D ÄE3ÄDÄE3Ä,E3Ä-AE.Å.E3c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   Ú	task_listzlist[dict[str, Any]]r=   r>   rÔ   r   r   z%tuple[list[TaskRoute], Optional[str]]r   )r   s   "r    r!   r!   9  s,   € ÷ ñ Ð#7ð ÐARð Ðbeð ØBñr#   c                óþ  € ^ RI Hp ^ RIHp V! V4      pV! W4      p \	        V4      p\        Ya4      p/ p	. p
\        T 4       FE  w  r¼ \        YhY¼Y4      p\        Y½T4       T
P                  \        YÒY‘TP                  4      4       KG  	  T
R3#   \
         d   p. \        T4      3u Rp?# Rp?ii ; i  \         d=   pT
P                  \        / / TP                  \        T4      R7      4        Rp?K´  Rp?ii ; i)aŒ  One :class:`TaskRoute` per task from the session's backend (its ``/delegation`` override, else
``delegation.backend``), or ``([], error)`` when that backend cannot run (fails closed, never another
backend). A task the backend cannot route gets a route with ``error`` set; its siblings are unaffected.
Identical routes resolve credentials once per call (the default backend resolves exactly once).)Úsession_delegation_config)Úconfigured_backendN)r   r   )Úagent.delegation_backendsr  rB   r  rC   r   r   rY   Ú	enumerater  rê   Úappendrã   rN   Ú
ValueErrorr   )r  r=   rÔ   r  r  rí   rE   rË   r  rß   ÚroutesÚir  r1   s   &&&           r    Úresolve_task_routesr  9  sñ   € õ DÝ<Ù˜vÓ&€EÙ& vÓ<€FðÜ# FÓ+ˆô $ HÓ5€HØ"$€EØ €FÜ˜YÖ'‰ˆð	TÜ˜x°1¸FÓJˆEÜ! !¨FÔ3Ø�M‰MÔ.¨uÀEÐS[×S`ÑS`ÓaÖbñ	 (ð �4ˆ<Ðøô  ô Ø”3�s“8ˆ|Õûðûô ô 	TØ�M‰Mœ) B¨°H·M±MÌÈSËÔR×SÒSûð	Tús5   žB Á	?B5ÂB2ÂB-Â'B2Â-B2Â5C<Ã 1C7Ã7C<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!   T  s&   € ÷ ^ñ ^ .ð ^Àð ^È	ñ ^r#   c                ó2   € ^ RI Hp \        V! W4      V 4      # )zžThe route an internal caller's explicit config block describes (``/review`` ->
``auxiliary.review``); bypasses the provider, as those callers own their route.rÖ   )rÛ   r×   r   )r   rÔ   r×   s   && r    Úroute_for_configr!  T  s   € õ DÜÑ4°[ÓOÐQ\Ó]Ð]r#   )Nr   )/r9   Ú
__future__r   r�   rS   ÚloggingÚreÚdataclassesr   r   Úpathlibr   Útypingr   r   r   r	   Úagent.delegation_providerr
   r   r   r   Ú	getLoggerrL   ÚcompilerQ   r   rC   rY   r`   rk   rq   rw   Úcontextmanagerr’   r˜   r°   r¶   rÍ   rÒ   rÝ   rã   rê   r  r  r  r!  r   r#   r    Ú<module>r,     sî   ðñõ #ã Û Û Û 	ß *Ý ß 3Ó 3÷ó ð 
×	Ò	Ð0Ó	1€à—’Ð5Ó6€ð ÷sð só ðsõ2'õ
õ*iõõ?õ'ð ×Ñôó ðõ<Sõõ,	QõZõDVõW÷,õ
JõWõ0qõ*÷6^r#   