+
    jHàj  ã                  ób   € R t ^ RIHt ^ RIt^ RIt^ RIt^ RIHtHt R R lt	R R lt
R R	 ltR# )
aë  ``active-work`` control verb: what a stop/restart of this gateway would interrupt, answered live.

``gateway_state.json`` names each unit only while draining and its ``active_agents`` total leaves out
async delegations, so a CLI asking "may I stop this gateway?" could not see a background subagent
that ``stop()`` interrupts (``tools.async_delegation.interrupt_all``). The verb answers from the
running process instead: the same units the drain report publishes plus every live delegation.
)ÚannotationsN)ÚAnyÚCallablec               ó    € V ^8„  d   QhRRRR/# )é   ÚnowÚfloatÚreturnúlist[dict[str, Any]]© )Úformats   "ÚA/home/ubuntu/.hermes/hermes-agent/gateway/run_active_work_verb.pyÚ__annotate__r      s   € ÷ ñ ˜5ð Ð%9ñ ó    c                ó¬  € ^ RI HpHp . pV! 4        F¾  pVP                  R4      V9  d   K  RRRVP                  R4      R\	        VP                  R4      ;'       g    R4      R,          R	\
        P                  ! 4       /pVP                  R
4      '       d'   \        V \        VR
,          4      ,
          ^4      VR&   VP                  V4       KÀ  	  V# )é    )Ú_LIVE_STATESÚlist_async_delegationsÚstatusÚkindÚ
delegationÚdelegation_idÚgoalÚ :NéP   NÚpidÚdispatched_atÚ	elapsed_s)
Útools.async_delegationr   r   ÚgetÚstrÚosÚgetpidÚroundr   Úappend)r   r   r   ÚunitsÚrecordÚunits   &     r   Ú_delegation_unitsr(      s¶   € ßKà€EÙ(Ö*ˆØ�:‰:�hÓ |Ô3ÙØ &¨°oÀvÇzÁzÐRaÓGbØ &¬¨F¯J©J°vÓ,>×,DÐ,DÀ"Ó(EÀcÕ(JÈEÔSU×S\ÒS\ÓS^ð `ˆà�:‰:�o×&Ò&Ü % c¬E°&¸Õ2IÓ,JÕ&JÈAÓ NˆD�ÑØ�‰�TÖñ +ð €Lr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úprofiler    r%   r
   r	   r   )r   s   "r   r   r       s#   € ÷ <ñ < Cð <Ð0Dð <ÐI]ñ <r   c                ó  € ^ RI Hp V! V4      R,           pV Uu. uFW  qUP                  R4      R8X  g   K  \        VP                  R4      ;'       g    R4      P	                  V4      '       g   KU  VNKY  	  pp\        V RR4      ;'       g    / P                  V4      p\        V R	R4      pVe   Ve   VP                  V4      MRp	^ R
IHp
 \        R \        V	R/ 4      P                  4        4       4      p\        \        V	RR4      ;'       g    / 4      pV	e   \        V
! V	4      4      M^ p\        P                  ! 4       pVRRRV/.V,          ,           RRRRRV/.V,          ,           RRRV/.V,          ,           # u upi )zÂWhat an ``unserve-profile`` of *profile* stops (``stop_authority_work``): its chat turns (session
keys in its namespace) plus its authority's managed turns and cron runs. Delegations survive it.)Ú_session_key_namespaceÚ:r   ÚchatÚsessionr   Ú_served_profile_homesNÚsession_authorities)Úside_agentsc              3  ó^   "  € T F#  qP                   P                  4       '       * x € K%  	  R # 5i)N)ÚclosedÚis_set)Ú.0Úws   & r   Ú	<genexpr>Ú!_profile_units.<locals>.<genexpr>,   s!   é € ÐeÑ1d¨A—h‘h—o‘oÓ'×'Ñ'Ó1dùs   ‚+-Ú_managed_workersÚ_cron_cancellationsÚmanagedr   ÚcronÚjob_idÚ?Ú
side_agent)Úgateway.sessionr,   r   r    Ú
startswithÚgetattrÚfor_homeÚgateway.session_runtime_workersr2   ÚsumÚvaluesÚlenr!   r"   )Úrunnerr*   r%   r,   ÚprefixÚuÚmineÚhomeÚregistryÚ	authorityr2   r<   ÚcronsÚsidesr   s   &&&            r   Ú_profile_unitsrR       sn  € õ 7á# GÓ,¨sÕ2€FÙÓk‘u�!§¡ f£°Ñ 7ŒA¼CÀÇÁÀiÓ@P×@VÐ@VÐTVÓ<W×<bÑ<bÐci×<j�AˆA‘u€DÐkÜ�FÐ3°TÓ:×@Ð@¸b×EÑEÀgÓN€DÜ�vÐ4°dÓ;€HØ+3Ò+?ÀDÒDT�×!Ñ! $Ô'ÐZ^€IÝ;äÑe´¸ÐDVÐXZÓ1[×1bÑ1bÔ1dÓeÓe€GÜ”˜	Ð#8¸$Ó?×EÐEÀ2ÓF€EØ+4Ò+@ŒC‘˜IÓ&Ô'Àa€EÜ
�)Š)‹+€CØ�V˜Y¨¨sÐ3Ð4°wÕ>Õ>À6È6ÐS[Ð]`ÐbgÐilÐBmÐAnÐqvÕAvÕvØ˜ e¨SÐ1Ð2°UÕ:õ;ð <ùò ls   šF¶FÁFÁ1Fc               ó   € V ^8„  d   QhRR/# )r   r	   zCallable[[], dict[str, Any]]r   )r   s   "r   r   r   4   s   € ÷ ñ Ð&Bñ r   c                ó   a a€ R VV 3R llpV# )zZHandler for the control socket: runs on its executor thread, reads the runner on the loop.c               ó    € V ^8„  d   QhRRRR/# )r   Úparamszdict[str, Any]r	   r   )r   s   "r   r   Ú&active_work_verb.<locals>.__annotate__7   s   € ÷ .ñ .˜ð .¨Nñ .r   c                óx  <aaaa€ V P                  R 4      o\        S\        4      ;'       d    \        S4      o. o\        P
                  ! 4       oR VVVVV3R llpSP                  V4       SP                  RR7      '       d	   S'       g   \        R4      h/ S^ ,          CR\        P                  ! 4       /C# )r*   c               ó   € V ^8„  d   QhRR/# )r   r	   ÚNoner   )r   s   "r   r   Ú8active_work_verb.<locals>._handler.<locals>.__annotate__=   s   € ÷ 	ñ 	˜$ñ 	r   c                 ó~  <€  \        SP                  4       4      \        \        P                  ! 4       4      ,           p S'       d/   \	        SSV 4      p SP                  R \        V 4      RV RS/4       M#SP                  R SP                  4       RV /4       SP                  4        R#   SP                  4        i ; i)Úactive_agentsÚactive_workr*   N)	ÚlistÚ_describe_active_workr(   ÚtimerR   r$   rH   Ú_active_work_countÚset)r%   ÚboxÚdoner*   rI   Úscopeds    €€€€€r   Ú_collectÚ4active_work_verb.<locals>._handler.<locals>._collect=   s’   ø€ ðÜ˜V×9Ñ9Ó;Ó<Ô?PÔQU×QZÒQZÓQ\Ó?]Õ]�ßÜ*¨6°7¸EÓB�EØ—J‘J ´°U³¸]ÈEÐS\Ð^eÐfÕgà—J‘J °×1JÑ1JÓ1LÈmÐ]bÐcÔdà—‘–
ø�—‘•
ús   ƒBB* Â*B<g      @)Útimeoutz,active-work: the gateway loop did not answerr   )r   Ú
isinstancer    ÚboolÚ	threadingÚEventÚcall_soon_threadsafeÚwaitÚRuntimeErrorr!   r"   )rV   rg   rd   re   r*   rf   ÚlooprI   s   & @@@@€€r   Ú_handlerÚ"active_work_verb.<locals>._handler7   s�   ü€ Ø—*‘*˜YÓ'ˆÜ˜G¤SÓ)×;Ð;¬d°7«mˆØ$&ˆÜ�ŠÓ ˆ÷	ô 	ð 	×!Ñ! (Ô+Ø�y‰y ˆy×%Ò%¯SÜÐMÓNÐNØ-�#�a•&Ð-˜%¤§¢£Ñ-Ð-r   r   )rI   rq   rr   s   ff r   Úactive_work_verbrt   4   s   ù€ ÷.ñ .ð0 €Or   )Ú__doc__Ú
__future__r   r!   rl   ra   Útypingr   r   r(   rR   rt   r   r   r   Ú<module>rx      s*   ðñõ #ã 	Û Û ß  õõ<÷(r   