+
    „WÝjo  ã                   óÈ   € R t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ]P                  ! ]
4      t]P                  ! 4       t]P                  ! 4       t]R R l4       tR R ltR# )	a^  Cross-process lock for ``provider_models_cache.json`` read-modify-write.

Parallel prefetch workers, SWR refresh threads and other Hermes processes (dashboard, desktop,
CLI) all rewrite the one cache file; each write must re-read it under this lock or a slow writer
puts back the snapshot it loaded before its fetch, dropping rows written meanwhile.
N)Úcontextmanager©ÚPath)ÚCallablec                ó$   € V ^8„  d   QhR\         /# )é   Úpathr   )Úformats   "ÚPC:\Users\johnn\AppData\Local\hermes\hermes-agent\hermes_cli\models_cache_lock.pyÚ__annotate__r      s   € ÷ ñ ¤Tñ ó    c           
   #   ó&  "  € ^ RI Hp \        ;_uu_ 4        V! V P                  V P                  R,           4      \
        RRV  R24      ;_uu_ 4        Rx € RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i5i)é    )Ú
_file_lockz.lockg      $@z6Timed out waiting for the provider models cache lock (Ú)N)Úhermes_cli.authr   Ú_thread_lockÚ	with_nameÚnameÚ_holder)r   r   s   & r
   Úprovider_models_cache_lockr      sc   é € å*ß	Ž‘z $§.¡.°·±¸WÕ1DÓ"EÄwÐPTØ$ZÐ[_ÐZ`Ð`aÐ"b÷dõ dã÷d�‰÷ d÷ dú��ˆüs4   ‚B—<A=ÁA*	ÁA=Á 
BÁ*A:Á5A=Á=B	Â	Bc                óF   € V ^8„  d   QhR\         R\        . R3,          RR/# )r   r   ÚwriteNÚreturn)r   r   )r	   s   "r
   r   r      s/   € ÷ 	Vñ 	V¤ð 	V¬h°r¸4°xÕ.@ð 	VÀTñ 	Vr   c                óÖ   €  \        V 4      ;_uu_ 4        V! 4        RRR4       R#   + '       g   i     R# ; i  \        \        3 d    \        P	                  RT RR7        R# i ; i)zÓRun ``write`` (re-read, set one row, save) under the thread + cross-process lock.

The file is a cache: an unwritable home or a wedged lock skips the write instead of failing
the model listing that triggered it.Nz(provider models cache write skipped (%s)T)Úexc_info)r   ÚOSErrorÚTimeoutErrorÚloggerÚdebug)r   r   s   &&r
   Úwrite_under_cache_lockr       sP   € ð
VÜ'¨×-Õ-ÙŒG÷ .×-×-Ò-ûä”\Ð"ô VÜ�‰Ð?ÀÐPTˆ×UðVús#   ‚; •'�; §8	²; ¸; »)A(Á'A()Ú__doc__ÚloggingÚ	threadingÚ
contextlibr   Úpathlibr   Útypingr   Ú	getLoggerÚ__name__r   ÚLockr   Úlocalr   r   r    © r   r
   Ú<module>r,      s]   ðñó Û Ý %Ý Ý à	×	Ò	˜8Ó	$€à�~Š~Ó€Ø
�/Š/Ó
€ð ôó ð÷	Vr   