+
    „WÝjÃ  ã                  óê   a € 0 t $ R t^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt	^ RI
Ht ]P                  ! ]4      tRt^tRsR]R&   Rs]P(                  3R R lltR	 R
 ltR R ltRR R lltR R ltR# )uS  Credentials and failure copy for the update check's api.github.com calls.

The passive source check asks the REST API for a branch tip. Unauthenticated
that budget is 60 requests/hour keyed on the *client IP*, so a shared exit
(office NAT, VPN, proxy) exhausts it for everyone behind it and the check
reports a 403 that read as "Hermes can't reach the update server".
Authenticating moves the caller onto the token's 5,000/hour budget.

Credential ladder: GITHUB_TOKEN, then GH_TOKEN, then ``gh auth token`` (the
gh CLI's own login â€” the only rung most desktop users have, since a
GUI-launched app inherits a minimal environment; its answer is cached per
process so the check never spawns gh more than once), then anonymous. A
token GitHub rejects (401) drops that request to anonymous. The token itself
never reaches a log line or an error string.
)ÚannotationsN)ÚOptionalúOptional[str]Ú_gh_cli_cacheFc               ó   € V ^8„  d   QhRR/# ©é   Úreturnr   © )Úformats   "ÚIC:\Users\johnn\AppData\Local\hermes\hermes-agent\hermes_cli\github_api.pyÚ__annotate__r   !   s   € ÷ ñ ¨]ñ ó    c                óŠ   € \          F8  pV P                  V4      ;'       g    RP                  4       pV'       g   K6  Vu # 	  R# )zLFirst non-blank env token, trimmed. A blank value falls through to the next.Ú N)ÚGITHUB_TOKEN_ENV_VARSÚgetÚstrip)ÚenvÚnameÚvalues   &  r   Úgithub_token_from_envr   !   s9   € ç%ˆØ—‘˜“×$Ð$ "×+Ñ+Ó-ˆß‰5ØŠLñ &ñ r   c               ó   € V ^8„  d   QhRR/# r   r
   )r   s   "r   r   r   *   s   € ÷ ñ �}ñ r   c                 ó¤  € \         '       d   \        # R s ^ RIHp   \        P
                  ! . R	OR R RR\        \        P                  V ! 4       RR7	      pTP                  ^ 8X  d   TP                  P                  4       MRpT;'       g    Rs\        #   \        \        P                  3 d"   p\        P                  RT4        Rp?R# Rp?ii ; i)
T)Úwindows_hide_flagszutf-8ÚreplaceF)Úcapture_outputÚtextÚencodingÚerrorsÚtimeoutÚstdinÚcreationflagsÚcheckz#gh CLI token lookup unavailable: %sNr   )ÚghÚauthÚtoken)Ú_gh_cli_probedr   Úhermes_cli._subprocess_compatr   Ú
subprocessÚrunÚ_GH_CLI_TIMEOUT_SECONDSÚDEVNULLÚOSErrorÚSubprocessErrorÚloggerÚdebugÚ
returncodeÚstdoutr   )r   ÚresultÚexcr&   s       r   Ú_gh_cli_tokenr5   *   s«   € çƒ~ÜÐØ€NÝ@ðÜ—’Ú#°D¸tÈgÐ^gÜ+´:×3EÑ3EÑUgÓUiØô
ˆð &,×%6Ñ%6¸!Ô%;ˆF�M‰M×ÑÔ!À€EØ—M�M˜T€MÜÐøô ”Z×/Ñ/Ð0ô Ü�‰Ð:¸CÔ@Ýûðús   œ8B ÂCÂ.C
Ã
Cc               ó   € V ^8„  d   QhRR/# r   r
   )r   s   "r   r   r   >   s   € ÷ 6ñ 6�mñ 6r   c                 ó:   € \        4       ;'       g    \        4       # )z7The credential for this request, or None for anonymous.)r   r5   r
   r   r   Úgithub_tokenr8   >   s   € ä Ó"×5Ð5¤m£oÐ5r   c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   r4   ÚBaseExceptionÚauthenticatedÚboolÚnowzOptional[float]r	   Ústrr
   )r   s   "r   r   r   C   s)   € ÷ "$ñ "$ ð "$¸tð "$È/ð "$Ðehñ "$r   c                ó  € \        V \        P                  P                  4      '       dÊ   V P                  pV P
                  ;'       g    / p\        VR4      pVR9   d‚   V^ 8X  d{   \        VR4      pRpVeO   \        Ybf   \        P                  ! 4       MT,
          ^;,           ^<,          4      pV^8¼  d   V^8X  d   RMRV R2pV'       d
   RV RV R	2# R
V RV R2# VR8¼  d   RV R2# RV R	2# \        V \        P                  P                  4      '       dI   V P                  p	\        V	\        4      '       g   R\        V	4      P                  4       9   d   R# RV	 R2# \        V \        4      '       d   R# RV  2# )uH  One line a user can act on instead of a generic "could not resolve" (#105855).

A 403/429 with ``x-ratelimit-remaining: 0`` is the anonymous per-IP budget spent
by every client behind one exit â€” the line names the fix the user actually has
(a GITHUB_TOKEN) and the real reset time. Any other status is reported as what it is.
zx-ratelimit-remainingzx-ratelimit-resetzwithin an hourzin about a minutez	in about z minutesz:GitHub API rate limit reached for your GITHUB_TOKEN (HTTP u   ) â€” it resets Ú.z$GitHub API rate limit reached (HTTP z�): anonymous requests are limited to 60 per hour per network address, shared with everyone behind the same connection. It resets z:; setting GITHUB_TOKEN in the environment lifts the limit.iô  zGitHub is having trouble (HTTP uE    from api.github.com) â€” check githubstatus.com and try again later.zapi.github.com answered HTTP z	timed outz0api.github.com did not answer within 10 seconds.z%Connection to api.github.com failed (u/   ) â€” check your connection, firewall or proxy.zapi.github.com: )i“  i­  )Ú
isinstanceÚurllibÚerrorÚ	HTTPErrorÚcodeÚheadersÚ_header_intÚintÚtimeÚURLErrorÚreasonÚTimeoutErrorr>   Úlower)
r4   r;   r=   ÚstatusrF   Ú	remainingÚresetÚwhenÚminutesrK   s
   &&&       r   Údescribe_github_failurerS   C   s�  € ô �#”v—|‘|×-Ñ-×.Ò.Ø—‘ˆØ—+‘+×#Ð# ˆÜ Ð)@ÓAˆ	Ø�ZÔ I°¤NÜ Ð)<Ó=ˆEØ#ˆDØÒ Ü˜u²{¬¯	ª	¬ÈÕLÈrÕQÐVXÕXÓY�Ø˜a”<Ø29¸Q´,Ñ.ÀiÐPWÈyÐX`ÐDa�DßØSÐTZÐS[Ð[kÐlpÐkqÐqrÐsÐsØ:¸6¸(ð CgØgkÐflð mOðOð Pð �SŒ=Ø5°f°Xð >+ð +ð ,à.¨v¨h°aÐ8Ð8Ü�#”v—|‘|×,Ñ,×-Ò-Ø—‘ˆÜ�fœl×+Ò+¨{¼cÀ&»k×>OÑ>OÓ>QÔ/QÙEØ6°v°hÐ>mÐnÐnÜ�#”|×$Ò$ÙAØ˜c˜UÐ#Ð#r   c               ó    € V ^8„  d   QhRRRR/# )r   r   r>   r	   zOptional[int]r
   )r   s   "r   r   r   h   s   € ÷ ñ ˜sð  }ñ r   c                ó˜   €  \        \        V P                  VR 4      4      P                  4       4      #   \        \
        3 d     R# i ; i)r   N)rH   r>   r   r   Ú	TypeErrorÚ
ValueError)rF   r   s   &&r   rG   rG   h   sB   € ðÜ”3�w—{‘{ 4¨Ó,Ó-×3Ñ3Ó5Ó6Ð6øÜ”zÐ"ô Úðús   ‚14 ´A	ÁA	)ÚGITHUB_TOKENÚGH_TOKEN)N)Ú__conditional_annotations__Ú__doc__Ú
__future__r   ÚloggingÚosr)   rI   Úurllib.errorrB   Útypingr   Ú	getLoggerÚ__name__r/   r   r+   r   Ú__annotations__r'   Úenvironr   r5   r8   rS   rG   )rZ   s   @r   Ú<module>re      sp   øðôõ #ã Û 	Û Û Û Ý à	×	Ò	˜8Ó	$€à4Ð ØÐ Ø#€ˆ}Ó #Ø€ð !Ÿj™j÷ õõ(6÷
"$÷Jr   