Ë
    A²XjÛ  ã                  ó–   — U d Z ddlmZ ddlZddlZddlmZmZ g d¢Zej                  efZ
ded<    eh d	£«      Zd
dœdd„Zdd„Zdd„Zy)a  Shared backoff / jitter / retry-classification helpers for the runner helpers.

Extracted so the control-plane poller, the session tool runner, and the worker
heartbeat all compute backoff and classify retryable failures the same way.
Consumed by the runner helpers only.
é    )ÚannotationsNé   )ÚAPIErrorÚAPIStatusError)ÚbackoffÚjitterÚis_fatal_status_errorÚTRANSIENT_ERRORSztuple[type[Exception], ...]r
   >   é˜  é™  é­  g       @)Úbasec               ó    — t        ||| z  «      S )zCExponential backoff for ``attempt`` (1-indexed), capped at ``cap``.)Úmin)ÚattemptÚcapr   s      úZ/var/www/html/content_generation/venv/lib/python3.12/site-packages/anthropic/lib/_retry.pyr   r       s   € äˆs�D˜'‘MÓ"Ð"ó    c                ó.   — t        j                  | |«      S )uE   Uniform random delay in ``[low, high)`` â€” spreads out retry storms.)ÚrandomÚuniform)ÚlowÚhighs     r   r   r   %   s   € ä�>‰>˜#˜tÓ$Ð$r   c                ó‚   — t        | t        «      xr. d| j                  cxk  xr dk  nc xr | j                  t        vS )zØTrue for a 4xx that retrying will not fix (bad key, missing resource).

    Aligns with the core client's ``_should_retry`` policy: 408 / 409 / 429 are
    transient and worth retrying; every other 4xx is fatal.
    i�  iô  )Ú
isinstancer   Ústatus_codeÚ_RETRYABLE_4XX)Úerrs    r   r	   r	   *   s6   € ô �cœ>Ó*Òu¨s°c·o±oÖ/KÈÔ/KÒuÐPS×P_ÑP_ÔguÐPuÐur   )r   Úintr   Úfloatr   r    Úreturnr    )r   r    r   r    r!   r    )r   Ú	Exceptionr!   Úbool)Ú__doc__Ú
__future__r   r   ÚhttpxÚ_exceptionsr   r   Ú__all__Ú	HTTPErrorr
   Ú__annotations__Ú	frozensetr   r   r   r	   © r   r   Ú<module>r-      sU   ðòõ #ã ã ç 2â
L€ð 27·±À(Ð0KÐ Ð-Ó Kñ
 š?Ó+€ð 8;õ #ó
%ô
vr   