+
    jHàj÷  ã                   óX   € R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt ! R R4      t]! 4       tR# )a  Process-owned admission fence for cooperative Desktop backend retirement.

The gate belongs to the process, not a profile or transport. Diagnostic ledgers alone cannot
close the check/use race: every source of new work must reserve admission before dispatch.
)ÚcontextmanagerNc                   ód   a € ] tR t^t o RtR tR tR tR tR t	]
R 4       tR tR	 tR
 tRtV tR# )ÚRetirementFencez÷Exclusive 30-second prepare permit; commit closes admission permanently.

Tokens are random and recognized only by this process instance. A committed prepare
returns the same token so a client can recover a lost commit response without reopening.
c                óª   € \         P                  ! 4       V n        ^ V n        RV n        RV n        RV n        RV n        \        P                  V n
        R# )é    FNg        )Ú	threadingÚLockÚ_lockÚ_activeÚ
_preparingÚ_tokenÚ
_committedÚ_expires_atÚtimeÚ	monotonicÚ_now©Úselfs   &ÚB/home/ubuntu/.hermes/hermes-agent/hermes_cli/backend_retirement.pyÚ__init__ÚRetirementFence.__init__   s?   € Ü—^’^Ó%ˆŒ
ØˆŒØˆŒØˆŒØˆŒØˆÔÜ—N‘NˆŽ	ó    c                óž   € V P                   e?   V P                  '       g+   V P                  4       V P                  8¼  d
   R V n         R # R # R # R # ©N)r   r   r   r   r   s   &r   Ú_expireÚRetirementFence._expire   s:   € Ø�;‰;Ò"¨4¯?¯?¨?¸t¿y¹y»{Èd×N^ÑN^Ô?^ØˆDŽKñ @_©?Ñ"r   c                ó  € V P                   ;_uu_ 4        V P                  4        V P                  '       g   V P                  e    R R R 4       R# V ;P                  ^,          un         R R R 4       R#   + '       g   i     R # ; i)NFT)r	   r   r   r   r
   r   s   &r   ÚacquireÚRetirementFence.acquire"   sO   € Ø�Z�Z‹ZØ�L‰LŒNØ��ˆ $§+¡+Ò"9Ø÷ ‰Zð �LŠL˜AÕ�LØ÷ �Z�ZŠZús   •2A5ÁA5Á5B	c                óš   € V P                   ;_uu_ 4        V ;P                  ^,          un        RRR4       R#   + '       g   i     R# ; i)é   N©r	   r
   r   s   &r   ÚreleaseÚRetirementFence.release*   s%   € Ø�Z�Z‹ZØ�LŠL˜AÕ�L÷ �Z�ZŠZús	   •9¹A
	c                ó€   € V P                   ;_uu_ 4        V P                  uuR R R 4       #   + '       g   i     R # ; ir   r!   r   s   &r   Úactive_countÚRetirementFence.active_count.   s   € Ø�Z�Z‹ZØ—<‘<÷ �Z�Z‹Zús   •,¬=	c              #  ó¨   "  € V P                  4       p Vx € V'       d   V P                  4        R # R #   T'       d   T P                  4        i i ; i5ir   )r   r"   )r   Úadmitteds   & r   ÚworkÚRetirementFence.work2   s<   é € à—<‘<“>ˆð	ØŠNçØ—‘–ñ ø�xØ—‘•ð üs   ‚A”4 ˜A´AÁAc           	     ó   € ^ RI Hp V P                  ;_uu_ 4        V P                  4        V P                  '       d   RRRRRV P
                  /uuRRR4       # V P                  '       g!   V P
                  f   V P                  '       d   RRRR/uuRRR4       # RV n        RRR4       Rp V! 4       R,          pV P                  ;_uu_ 4        RV n        VRJ d:   \        P                  ! ^ 4      ;V n        pV P                  4       R
,           V n        RRR4       TRJd   RRRT/# RRRRRX/#   + '       g   i     L˜; i  \         d/    \        P                  ! \        4      P                  RRR	7        LÂi ; i  + '       g   i     Ls; i  T P                  ;_uu_ 4        RT n        TRJ d:   \        P                  ! ^ 4      ;T n        pT P                  4       R
,           T n        RRR4       i   + '       g   i     i ; i; i)r   )Ú
idle_proofÚokTÚidleÚtokenNFz!Retirement idle probe unavailable)Úexc_infog      >@)Ú hermes_cli.web_server_idle_proofr,   r	   r   r   r   r   r
   Ú	ExceptionÚloggingÚ	getLoggerÚ__name__ÚwarningÚsecretsÚtoken_urlsafer   r   )r   r,   Úverdictr/   s   &   r   ÚprepareÚRetirementFence.prepare;   s’  € Ý?à�Z�Z‹ZØ�L‰LŒNØ��ˆØ˜d F¨D°'¸4¿;¹;ÐG÷ ŠZð ��ˆ $§+¡+Ò"9¸T¿\¿\¸\Ø˜e V¨UÐ3÷ ŠZð #ˆDŒO÷ ð ˆð		:Ù “l 6Õ*ˆGð ——“Ø"'�”Ø˜d“?Ü*1×*?Ò*?ÀÓ*CÐC�D”K %Ø'+§y¡y£{°TÕ'9�DÔ$÷	 ð
 ˜$ÓØ˜% ¨Ð1Ð1Ø�d˜F D¨'°5Ð9Ð9÷- �Zûô ô 	dÜ×ÒœhÓ'×/Ñ/Ð0SÐ^bÐ/Öcð	dú÷ —û�——“Ø"'�”Ø˜d“?Ü*1×*?Ò*?ÀÓ*CÐC�D”K %Ø'+§y¡y£{°TÕ'9�DÔ$÷	 ——�ýsm   ›4D3ÁD3Á,D3ÂD3ÂD3Â.E ÃAFÄ3E	Å6E?Å<F Å>E?Å?F ÆF	ÆHÆ*AG:	Ç1	HÇ:H
ÈHc                óê   € V P                   ;_uu_ 4        V P                  4        V'       d   WP                  8w  d   R R/uuRRR4       # RV n        R R/uuRRR4       #   + '       g   i     R# ; i©r-   FNT©r	   r   r   r   ©r   r/   s   &&r   ÚcommitÚRetirementFence.commitV   sJ   € Ø�Z�Z‹ZØ�L‰LŒNß˜E§[¡[Ô0Ø˜e�}÷ ŠZð #ˆDŒOØ˜$�<÷ �Z�Z‹Zús   •,A!Á
A!Á!A2	c                ó  € V P                   ;_uu_ 4        V P                  4        V'       d#   WP                  8w  g   V P                  '       d   R R/uuRRR4       # RV n        R R/uuRRR4       #   + '       g   i     R# ; ir=   r>   r?   s   &&r   ÚcancelÚRetirementFence.cancel^   sR   € Ø�Z�Z‹ZØ�L‰LŒNß˜E§[¡[Ô0°D·O·O°OØ˜e�}÷ ŠZð ˆDŒKØ˜$�<÷ �Z�Z‹Zús   •:A3ÁA3Á
A3Á3B	)r
   r   r   r	   r   r   r   N)r5   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r   r"   r%   r   r)   r:   r@   rC   Ú__static_attributes__Ú__classdictcell__)Ú__classdict__s   @r   r   r      sK   ø‡ € ñò#òòòò ð ñó ðò:ò6 ÷ ð  r   r   )	rH   Ú
contextlibr   r3   r7   r   r   r   Ú
retirement© r   r   Ú<module>rO      s2   ðñõ &Û Û Û Û ÷V ñ V ñr Ó‚
r   