ó
    ±"³jÅ  ã                  ó|   • S SK Jr  S SKJr  S SKJr  S SKJr  S SKJ	r	  S SK
JrJrJr  \" S\	S9r        SS	 jrg
)é    )Úannotations)ÚTypeVar)Úawait_maybe)Ú	UserError)ÚAbstractNativeTool)Ú
AgentDepsTÚNativeToolFuncÚ
RunContextÚ_NativeToolT)Úboundc              ƒ  ó  #   • Ub.  [        U[        5      (       d  [        U" U5      5      I Sh  v•N nUc&  [        SU R                   SU R                   S35      e[        X5      (       d  [        SU R                   SU< 35      eU$  N[7f)aË  Resolve a native tool instance or factory, raising if it doesn't yield a `tool_cls`.

A factory returning `None` means "omit this tool" on the native path
([`NativeToolFunc`][pydantic_ai.tools.NativeToolFunc]). The fallback subagent cannot omit
once it has already been invoked, so it raises [`UserError`][pydantic_ai.exceptions.UserError]
rather than enabling the default tool.

`tool_cls` comes first so the return type is solved from it rather than from `native_tool`,
which is what lets callers use the result as a `tool_cls` without re-asserting.

KEEP IN SYNC with the graph's resolution in `_prepare_request_parameters`, with two deliberate
differences: `None`, which the native path omits for that step while the already-invoked
fallback subagent cannot, so it raises; and the result type, which the graph accepts as any
`AbstractNativeTool` while the fallback subagent needs the `tool_cls` its subagent is built
around, so a sibling native tool raises here too.
NÚ`z‚` native tool factory returned `None`, but the already-invoked `fallback_subagent_model` subagent cannot omit the tool. Return a `zL` instance, or drop `fallback_subagent_model` so that `None` omits the tool.z,Native tool must resolve to an instance of `z`, got )Ú
isinstancer   r   r   Ú__name__)Útool_clsÚnative_toolÚctxs      Úh/home/mande/repo/quber/.venv/lib/python3.13/site-packages/pydantic_ai/capabilities/_native_resolution.pyÚresolve_native_toolr      s¢   é € ð* Ñ¤z°+Ô?Q×'RÑ'RÜ'©°CÓ(8Ó9×9ˆØÑÜØ�×!Ñ!Ð"ð #à!×*Ñ*Ð+Ð+wðyó
ð 	
ô
 �k×,Ñ,ÜÐFÀx×GXÑGXÐFYÐY`ÐalÑ`oÐpÓqÐqØÐñ :ùs   ‚-B¯B°ABN)r   ztype[_NativeToolT]r   z6AbstractNativeTool | NativeToolFunc[AgentDepsT] | Noner   zRunContext[AgentDepsT]Úreturnr   )Ú
__future__r   Útypingr   Úpydantic_ai._utilsr   Úpydantic_ai.exceptionsr   Úpydantic_ai.native_toolsr   Úpydantic_ai.toolsr   r	   r
   r   r   © ó    r   Ú<module>r      sP   ðÝ "å å *Ý ,Ý 7ß DÑ Dá�~Ð-?Ñ@€ðØ ðàGðð 
 ðð õ	r   