+
    lHàjÏ  ã                   ó´   € R t ^RIHtHt ]! 4       t]P
                  tRtRtR tR t	]! R4      R 4       t
R t]! R4      R	 4       t
]! R
4      R 4       t
R tR# )zëSession-scoped roster and bounded live transcript snapshots for shared clients.

Async projection adapted from JoaoMarcos44's PR #70899; controls reuse the
existing subagent.steer RPC rather than introducing a second steering runtime.
)ÚHandlerRegistryÚbind_modulei @  c           	      óB  € ^ RI HpHpHp T;_uu_ 4        VP	                  4        Uu. uFM  pVP                  R4      V 8X  g   K  V! Wa4      '       g   K+  VP                  R4      VJ g   KB  \        V4      NKO  	  upuuRRR4       # u upi   + '       g   i     R# ; i)é    )Ú_active_subagentsÚ_active_subagents_lockÚ_subagent_transport_matchesÚowner_session_idÚowner_session_recordN)Útools.delegate_tool_registryr   r   r   ÚvaluesÚgetÚdict)Ú
session_idÚ	transportÚownerr   r   r   Úrs   &&&    ÚB/home/ubuntu/.hermes/hermes-agent/tui_gateway/methods_subagents.pyÚ_owned_subagent_recordsr      s‰   € ßsÑsç	Ò	Ø!2×!9Ñ!9Ô!;ó <Ñ!;˜AØ—5‘5Ð+Ó,°
Ñ:ô á/°×=ô ð —E‘EÐ0Ó1°UÐ:ô ”�Q–Ñ!;ñ <÷ 
 Ò	ùò<÷ 
 ×	Ð	ús.   •B¨BÁBÁBÁ,BÁ;BÂBÂB	c                ó¢  € ^ RI HpHpHpHp T;_uu_ 4        VP                  4        Uu. uF  p\        V4      NK  	  ppRRR4       VP                  R4      p	X Uu. uFN  pVP                  R4      V 8X  d$   V! Wq4      '       d   VP                  R4      VJ g   V! Wy4      '       g   KL  VNKP  	  up# u upi   + '       g   i     L�; iu upi )uq  Read-only roster for ``subagent.list``: the exact-owner records PLUS children whose durable
conversation lineage (``owner_agent_session_id`` resolved to its compression tip) is this
session's agent â€” the same spine ``delegate_task(action="list")`` walks in-process.

Spawn freezes ``owner_session_id`` to the UI session id of that moment; a Desktop reconnect /
resume remints the id and rebuilds the session record, and compression rotates the durable key,
so the exact match alone hid every still-running child from the panel for good (#114909).
Control RPCs (steer / interrupt / tail) keep the exact generation authority.)r   r   Ú_owns_subagent_recordr   NÚagentr	   r
   )r   r   r   r   r   r   r   r   )
r   r   r   r   r   r   r   r   Úrecordsr   s
   &&&       r   Ú_visible_subagent_recordsr      s´   € ÷ó ÷ 
 Ò	Ø$5×$<Ñ$<Ô$>Ó?Ñ$>˜q”4˜–7Ñ$>ˆÐ?÷ 
 à�I‰I�gÓ€Eáó 0‘w�!Ø—‘Ð(Ó)¨ZÔ7Ù/°×=Ò=Ø—E‘EÐ0Ó1°UÓ:Ù$ Q×.÷	 ˆA‘wñ 0ð 0ùò @÷ 
 ×	üò0s(   —B9ªB4¾B9ÁA	CÂ+CÂ4B9Â9C		zsubagent.listc                 ó(  € \        VR 4      p\        V4      w  r4Ve   Vf   \        V RR4      # \        W#V4      p\	        T RV UUu. uF(  p\
         Uu/ uF  qwVP                  V4      bK  	  upNK*  	  uppR\        W$4      /4      # u upi u uppi )r   é¡  ú0session not found or not owned by this transportÚ	subagentsÚdelegations)Ú
_str_paramÚ _current_session_steer_authorityÚ_errr   Ú_okÚ_SUBAGENT_SNAPSHOT_FIELDSr   Ú_failed_delegations)ÚridÚparamsr   r   r   Úliver   Úkeys   &&      r   Ú_r)   5   sš   € ä˜F LÓ1€JÜ7¸
ÓCÑ€IØÒ˜EšMÜ�C˜ÐQÓRÐRÜ$ Z¸EÓB€DÜˆsØÑVZÔ[ÑVZÐQRÕ2KÓLÑ2K¨3˜AŸE™E #›J’Ñ2KÔLÑVZÒ[ØÔ*¨:Ó=ðó ð ùÚLùÓ[s   ÁBÁB	Á.BÂ	Bc                ó8  € ^ RI Hp \        \        VP	                  R4      RR4      ;'       g    R4      p \        V4      ;_uu_ 4        V! W4      uuRRR4       #   + '       g   i     R# ; i  \         d    \        P                  RT RR7       . u # i ; i)	a  Recently failed async delegation tasks for this session from the durable store (the live
roster forgets ended children and dies with a renderer reload, #97202). Read under the session's
profile home, where its delegations were persisted; a store error degrades to no rows.)Úfailed_delegations_for_sessionr   r   Ú Nz3subagent.list: failed-delegation read failed for %sT©Úexc_info)	Útools.async_delegationr+   ÚstrÚgetattrr   Ú_session_home_scopeÚ	ExceptionÚloggerÚdebug)r   r   r+   Úagent_session_ids   &&  r   r$   r$   B   s{   € õ Fäœ7 5§9¡9¨WÓ#5°|ÀRÓH×NÐNÈBÓOÐðÜ  ×'Õ'Ù1°*ÓO÷ (×'×'Ó'ûäô Ü�‰ÐJÈJÐaeˆÔfØŠ	ðús/   ·A1 Á
AÁ
A1 ÁA.	Á(A1 Á.A1 Á1%BÂBzsubagent.interruptc                 óÎ  a	€ ^ RI Hp \        VR4      o	S	'       g   \        V RR4      # \        VR4      p\	        V4      w  rEVe   Vf   \        V RR4      # \        V	3R	 l\        W4V4       4       R4      pV'       d   VP                  R
4      MRpRpVe    \        V! VRS	 R24      4      p\        V RVRS	/4      #   \         d    \        P                  RRR7        L4i ; i)r   )Úrequest_hard_interruptÚsubagent_idé   úsubagent_id requiredr   Nr   r   c              3   óX   <"  € T F  pVP                  R 4      S8X  g   K  Vx € K!  	  R# 5i©r9   N©r   ©Ú.0r   r9   s   & €r   Ú	<genexpr>Ú_.<locals>.<genexpr>\   ó+   øé € ð ;ÑS˜Ø—e‘e˜MÓ*¨kÑ9÷ ’1ÓSùó   ƒ* 
*r   FzInterrupted via TUI (Ú)zsubagent interrupt failedTr-   Úfound)Úagent.interrupt_compatr8   r   r!   r    Únextr   r   Úboolr3   r4   r5   r"   )
r%   r&   r8   r   r   r   Úrecordr   rF   r9   s
   &&       @r   r)   r)   Q   sö   ø€ å=ä˜V ]Ó3€KßÜ�C˜Ð5Ó6Ð6Ü˜F LÓ1€JÜ7¸
ÓCÑ€IØÒ˜EšMÜ�C˜ÐQÓRÐRÜô ;Ô5°jÈUÔSó ;Ø<@óB€Fç#)ˆF�J‰J�wÔ¨t€Eà€EØÒð	EÜÑ/°Ð9NÈ{ÈmÐ[\Ð7]Ó^Ó_ˆEô ˆs�W˜e ]°KÐ@ÓAÐAøô ô 	EÜ�L‰LÐ4¸tˆLÖDð	Eús   ÂB? Â?"C$Ã#C$zsubagent.tailc                 óø  a€ \        VR 4      p\        VR4      oS'       g   \        V RR4      # \        V4      w  r4Ve   Vf   \        V RR4      # RSRRR	R
RR/p\        V3R l\	        W#V4       4       R4      pV'       d   \        VP                  R4      RR4      MRpV'       g   \        W4      #  \        VR4      ;_uu_ 4       pVP                  ^ ^4      p	VP                  \        ^ V	\        ,
          4      4       VP                  \        4      P                  RRR7      p
RRR4       \        T / TCRRR	X
RX	\        8„  /C4      #   + '       g   i     L-; i  \         d    \        Y4      u # i ; i)r   r9   r:   r;   Nr   r   Ú	availableFÚtextr,   Ú	truncatedc              3   óX   <"  € T F  pVP                  R 4      S8X  g   K  Vx € K!  	  R# 5ir=   r>   r?   s   & €r   rA   rB   s   rC   rD   r   Ú_live_transcript_pathÚrbzutf-8Úignore)ÚerrorsT)r   r!   r    rH   r   r1   r   r"   ÚopenÚseekÚmaxÚ_SUBAGENT_TAIL_BYTESÚreadÚdecodeÚOSError)r%   r&   r   r   r   ÚresultrJ   ÚpathÚstreamÚsizerM   r9   s   &&         @r   r)   r)   i   sh  ø€ ä˜F LÓ1€JÜ˜V ]Ó3€KßÜ�C˜Ð5Ó6Ð6Ü7¸
ÓCÑ€IØÒ˜EšMÜ�C˜ÐQÓRÐRØ˜[¨+°u¸fÀbÈ+ÐW\Ð]€FÜô ;Ô5°jÈUÔSó ;Ø<@óB€FçJPŒ7�6—:‘:˜gÓ&Ð(?ÀÔFÐVZ€DßÜ�3ÓÐð Ü�$˜×Ô Ø—;‘;˜q !Ó$ˆDØ�K‰Kœ˜A˜tÔ&:Õ:Ó;Ô<Ø—;‘;Ô3Ó4×;Ñ;¸GÈHÐ;ÓUˆD÷ ô ˆsÐi�vÐi˜{¨D°&¸$ÀÈTÔThÑMhÑiÓjÐj÷ ×ûô ô  ä�3ÓÒð ús1   Â5E  Ã	AEÄ(E  ÅE	ÅE  ÅE  Å E9Å8E9c                 ó.   € \        \        4       V 4       R # )N)r   Úglobals)Úservers   &r   Úregisterrb   ƒ   s   € Ü”“	˜6Ö"ó    N)r9   Ú	parent_idÚdepthÚgoalÚdelegation_idÚmodelÚ
started_atÚstatusÚ
tool_countÚ	last_toolÚaccepting_steer)Ú__doc__Ú
method_ctxr   r   Ú	_registryÚmethodr#   rW   r   r   r)   r$   rb   © rc   r   Ú<module>rs      s–   ðñ÷ 5áÓ€	Ø	×	Ñ	€ðÐ ð Ð ò<ò0ñ0 ˆÓñ	ó ð	òñ ÐÓñBó ðBñ. ˆÓñkó ðkô2#rc   