+
    lHàjÝ
  ã                  óf   € R t ^ RIHt ^ RIt^ RIt^ RIHt ^ RIHt ^ RI	H
t
 R.t ! R R]4      tR# )u4  Shared daemon-thread ThreadPoolExecutor.

Stdlib workers are non-daemon AND registered in ``_threads_queues``, whose atexit
hook joins every worker even after ``shutdown(wait=False)`` â€” one wedged worker
(tool blocked on network I/O, hung provider, stuck subagent) blocks interpreter
exit forever. This variant spawns daemon workers and skips that registration.
Use it for best-effort/interruptible work that must never hold the process open;
NOT for work that must complete before exit (durable writes belong on foreground
threads with explicit bounded joins).
)ÚannotationsN)ÚThreadPoolExecutor)Ú_worker)Úcopy_contextÚDaemonThreadPoolExecutorc                  ó8   a € ] tR t^tRtV 3R ltR R ltRtV ;t# )r   zCThreadPoolExecutor variant whose workers do not block process exit.c               óR   <aa€ \        4       oVV3R lp\        SV `  ! V.VO5/ VB # )zÝKeep each task in its caller's profile scope, even on a reused worker.

Thread-start context cannot track later submissions from other profiles
(#54937). The stdlib worker context manages initialization, not contextvars.
c                 ó0   <€ SP                   ! S.V O5/ VB # ©N)Úrun)Ú	call_argsÚcall_kwargsÚctxÚfns   *,€€Ú6/home/ubuntu/.hermes/hermes-agent/tools/daemon_pool.pyÚ_run_with_contextÚ:DaemonThreadPoolExecutor.submit.<locals>._run_with_context"   s   ø€ Ø—7’7˜2Ð9 	Ò9¨[Ñ9Ð9ó    )r   ÚsuperÚsubmit)Úselfr   ÚargsÚkwargsr   r   Ú	__class__s   "b*, @€r   r   ÚDaemonThreadPoolExecutor.submit   s+   ú€ ô ‹nˆö	:ä‰wŠ~Ð/ÐA°$ÒA¸&ÑAÐAr   c               ó   € V ^8„  d   QhRR/# )é   ÚreturnÚNone© )Úformats   "r   Ú__annotate__Ú%DaemonThreadPoolExecutor.__annotate__&   s   € ÷  !ñ  ! dñ  !r   c                	óZ  € V P                   P                  ^ R7      '       d   R# V P                  3R lp\        V P                  4      pW P
                  8  dÒ   V P                  ;'       g    T  RVR 2p\        P                  ! W4      p\        V R4      '       d   VV P                  4       V P                  3pM$VV P                  V P                  V P                  3p\        P                  ! V\        RVR7      pVP!                  4        V P                  P#                  V4       R# R# )	é    )ÚtimeoutNc                ó(   € VP                  R 4       R # r
   )Úput)Ú_Úqs   &&r   Ú
weakref_cbÚADaemonThreadPoolExecutor._adjust_thread_count.<locals>.weakref_cb,   s   € Ø�E‰E�$ŽKr   r(   ÚdÚ_create_worker_contextT)ÚnameÚtargetÚdaemonr   )Ú_idle_semaphoreÚacquireÚ_work_queueÚlenÚ_threadsÚ_max_workersÚ_thread_name_prefixÚweakrefÚrefÚhasattrr-   Ú_initializerÚ	_initargsÚ	threadingÚThreadr   ÚstartÚadd)r   r*   Únum_threadsÚthread_nameÚexecutor_refÚworker_argsÚts   &      r   Ú_adjust_thread_countÚ-DaemonThreadPoolExecutor._adjust_thread_count&   s
  € ð ×Ñ×'Ñ'°Ð'×2Ò2Ùà ×,Ñ,ô 	ä˜$Ÿ-™-Ó(ˆØ×*Ñ*Ô*Ø!×5Ñ5×=Ð=¸Ð>¸aÀÈA¸ÐOˆKÜ"Ÿ;š; tÓ8ˆLÜ�tÐ5×6Ò6ð !Ø×/Ñ/Ó1Ø×$Ñ$ð‘ð !Ø×$Ñ$Ø×%Ñ%Ø—N‘Nð	�ô × Ò Ø ¬¸Ø ôˆAð �G‰GŒIØ�M‰M×Ñ˜aÖ ñ/ +r   r   )	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   rF   Ú__static_attributes__Ú__classcell__)r   s   @r   r   r      s   ø† ÙMõ
B÷ !ó  !r   )rL   Ú
__future__r   r=   r8   Úconcurrent.futuresr   Úconcurrent.futures.threadr   Úcontextvarsr   Ú__all__r   r   r   r   Ú<module>rT      s3   ðñ	õ #ã Û Ý 1Ý -Ý $à%Ð
&€ô/!Ð1ö /!r   