+
    jHàjuÇ  ã                   óL  € R t ^ RIt^ RIHt ^ RIt^ RIHt ^ RIt^ RIH	t	 ^ RI
HtHt ^ RIHt ^ RIHt ^ RIHtHt ^ R	IHt ^ R
IHtHtHt ]P4                  ! ]4      t^ RIHtHtH t H!t!H"t"H#t#H$t$H%t%H&t& ]'! 0 R<m4      t(Rt)]'! 0 R=m4      t*R>t+R?R lt,R t-R t.R t/R@R lt0Rt1R t2R t3R t4R t5R t6R t7R t8R t9R t:RR/R lt;R t<R@R lt=R  t>R! t?R" t@R# tAR$ tBR% tCR& tDR' tER( tFR) tGR* tHR+ tIR, tJR- tKR. tLR/ tMR0 tNR1 tOR2 tPR3 tQR@R4 ltRR5 tSR6 tTR7 tUR8 tVR9 tWRAR: ltXR; tYR# )BzòBot Chat ingress into the existing authority FIFO; viewers never own delivery.

The mailbox is a delivery receipt, not an execution queue. A committed canonical
admission is the only consumer; unknown execution is never retried as inference.
N)Úpartial)ÚPath)Úparse_turn_author)Ú	PrincipalÚ
SessionRef)ÚPlatform)ÚMessageEvent)ÚRuntimeStoreErrorÚget_session_admission)ÚHELD_NOT_SENT)Ú	_TERMINALÚ_delivery_idÚ_read)	Úmailbox_lockÚread_receiptÚwrite_receiptÚscan_receiptsÚremember_receiptÚtrack_receipt_taskÚwithdraw_pinÚ
refuse_pinÚrequeue_piniH?  c                óH  € VP                  R4      p\        V\        4      '       d   W0P                  8w  d   R#  \	        V4       T Uu. uF:  p\        TP                  T4      \        4      '       d   Y,          '       d   K8  TNK<  	  ppT'       d   RRP                  T4      ,           # \        TP                  R4      \        4      '       g   R# TP                  R4      p\        T\        4      '       d   T\        9  d   R	T: 2# R
#   \
         d     R# i ; iu upi )zCReturn why an admission-backed receipt is unsafe for bulk recovery.Údelivery_idz#delivery id does not match filenamezdelivery id is invalidzmissing canonical fields: z, Úmessagezmessage is not a stringÚstatuszunknown canonical status N)ÚgetÚ
isinstanceÚstrÚstemr   Ú
ValueErrorÚjoinÚ_CANONICAL_RECEIPT_STATUSES)ÚpathÚrecordÚrequired_stringsr   ÚkeyÚmissingr   s   &&&    Ú8/home/ubuntu/.hermes/hermes-agent/gateway/session_bot.pyÚ_canonical_record_errorr)   )   sð   € à—*‘*˜]Ó+€KÜ�k¤3×'Ò'¨;¿)¹)Ô+CÙ4ð(Ü�[Ô!ñ /ó KÑ.�sÜ  §¡¨C£´#×6Ò6¸f¿k¹k÷ ˆsÑ.€Gð KçØ+¨d¯i©i¸Ó.@Õ@Ð@Ü�f—j‘j Ó+¬S×1Ò1Ù(Ø�Z‰Z˜Ó!€FÜ�fœc×"Ò" fÔ4OÔ&OØ*¨6©*Ð5Ð5Ùøô ô (Ú'ð(üòKs   »D Á
5DÂDÄDÄDc                ó  € VP                  R4      RJ d,   RV9  d%   VP                  R4      R8w  d   R# \        WR4      # RV9   g   VP                  R4      R8X  g   RV9   d   \        W4      # R	V9   d   ^ R
IHp V! W4      # R# )zRValidate the known canonical, refused or legacy receipt shape for directory scans.ÚrefusedTÚadmission_idr   Úfailedzrefused receipt is not failedÚprincipal_idÚ	canonicalÚowner)Ú_ticket_shape_errorzunknown receipt schema©Úprofile_homeÚ
session_idr.   )r   r)   Útools.bot_live_deliveryr1   )r#   r$   r1   s   && r(   Ú_record_shape_errorr6   >   s€   € à‡z�z�)Ó Ó$¨¸vÔ)Eà�:‰:�hÓ 8Ô+Ù2Ü& tÐ5cÓdÐdØ˜Ô 6§:¡:¨hÓ#7¸;Ô#FÈ.Ð\bÔJbÜ& tÓ4Ð4Ø�&ÔÝ?Ù" 4Ó0Ð0Ù#ó    c                óŠ   € VP                  R4      R8H  ;'       d)    RV9  ;'       d    RV9  ;'       d    \        WR4      RJ # )zYThe ``ambiguous`` pin ``_admit`` writes before it admits: no admission id, never refused.r   Ú	ambiguousr,   r+   Nr2   )r   r)   )r#   r$   s   &&r(   Ú_is_pre_admission_pinr:   M   s^   € à�J‰J�xÓ  KÑ/÷ nð n°NÈ&Ñ4P÷ nð nÐU^ÐflÑUl÷ nð nÜ'¨Ð6dÓeÐimÐmðor7   c                 óZ   € \         P                  ! \        4      P                  R W4       R# )z.Skipping malformed Bot mailbox receipt %s (%s)N)ÚloggingÚ	getLoggerÚ__name__Úwarning)r#   Úproblems   &&r(   Ú_warn_malformedrA   S   s   € Ü×Ò”hÓ×'Ñ'Ð(XÐZ^Öhr7   c              #  ó�  "  € V P                  R4       F‚  p \        V4      pVf   RM
\        W#4      pVeC   Ve?   \        W#4      '       d.   VP	                  W#VP                  4       P                  34       Kf  Te   \        Y$4       Kw  Tf   K}  Y#3x € K„  	  R#   \        \        3 d   pR\        T4      rC Rp?LDRp?ii ; i5i)a  Bulk mailbox scan: isolate unreadable/malformed records; exact-id reads still fail closed.
An owner scan passes ``pins``: pre-admission pins land there with their mtime, unwarned, since
only the owner can tell whether their admission committed (``_scan_owner_receipts``).z*.jsonN)Úglobr   r6   r:   ÚappendÚstatÚst_mtimeÚOSErrorr    r   rA   )ÚrootÚpinsr#   r$   r@   Úexcs   &&    r(   Ú_scan_recordsrK   W   s²   é € ð —	‘	˜(Ö#ˆð	-Ü˜4“[ˆFØ$šn‘dÔ2EÀdÓ2SˆGØÒ" tÒ'7Ô<QÐRV×<_Ò<_Ø—‘˜T¨4¯9©9«;×+?Ñ+?Ð@ÔAÙð ÒÜ˜DÔ*ÙØÔØ�,Ôó $øô œÐ$ô 	-Ø"¤C¨£H•Gûð	-üs5   ‚C˜A BÁ8CÂCÂCÂ-B>Â9CÂ>CÃCi,  c              ƒ  ó2  "  € . Rr2\        W4      G Rj  x€L
 w  rEV EFj  w  rgpVR,          \        P                  ! 4       V,
          RV9   rºp	VR,          \        V4      8w  g   \        WRV	,           4      '       d   \	        V\        Wg4      4       Kw  RpV
\        8¼  dP   V'       dH   \        W4      G Rj  x€L
 pVRJ;'       d    \        Wm4      RJ pV'       d   VP                  Wm34       MV
\        8¼  d   \        W4      G Rj  x€L
 pV'       g=   V'       d   \        Wg4      pVf   TM
\        W>4      p\	        V\        Wg4      4       EK5  \        P                  ! \        4      P                  RV'       d   RMR	Wš4       EKm  	  WEV3#  EL| LÛ L‹5i)
a  The owner's bulk scan, under the mailbox lock ``_admit`` holds. A pre-admission pin past the
grace window whose ``bot:<key>`` never committed (refused by an older build, a death before the
commit, a transient refusal on the legacy migration path) is withdrawn as ``_admit`` withdraws
one: the scan stops warning and a same-id resend admits once. A pin laid over a legacy ticket
(``owner``) is that never-run message's only copy: it is requeued instead, for ``_migrate`` to
admit once under the same id. A pin whose admission committed stays the explicit unknown record
and keeps its warning.

Also returns the FIFO barrier: the lowest ``_legacy_order`` of a legacy pin of this home that is
still unresolved (inside the grace window, or its requeue lost to a concurrent change). No
legacy ticket ordered after it may be admitted by this pass. It holds for one scan only: past
the grace window the pin is requeued and released, and a failed requeue is re-read by the next
scan (gone, admitted or a ticket again), so the barrier never outlives the pin.Nr   r0   r3   úbot:FzD%s Bot delivery %s pre-admission pin (age %ds): nothing was admittedÚRequeuedÚWithdrew)r   Útimer   Ú_pin_committedrA   r6   Ú_PIN_GRACE_SECONDSr   rD   r   Ú_legacy_orderÚminr<   r=   r>   Úinfo)Ú	authorityÚhomerI   ÚbarrierrH   Úrecordsr#   r$   Úmtimer&   ÚageÚlegacyÚclearedÚticketÚorders   &&             r(   Ú_scan_owner_receiptsr`   p   sZ  é € ð ˜ˆ'Ü'¨Ó3×3�M€DÜ#Ñˆ�eØ! -Õ0´$·)²)³+ÀÕ2EÀwÐRXÑGX�&ˆØ�>Õ"¤c¨$£iÔ/Ü! )°V¸cµ\×BÒBÜ˜DÔ"5°dÓ"CÔDÙØˆØÔ$Ô$¯Ü& tÓ1×1ˆFØ DÐ(×VÐVÔ-@ÀÓ-NÐRVÐ-VˆGßØ—‘ ˜~Ô.øØÔ&Ô&Ü(¨Ó3×3ˆGßßÜ% dÓ3�Ø#*¢?™%¼¸GÓ8K�Ü˜DÔ"5°dÓ"CÔDÚÜ×Òœ(Ó#×(Ñ(Ð)oß7=©À:Ès÷	Yñ)  $ð, ˜'Ð!Ð!ò/ 4ñ 2ñ
 4ùsY   ‚F”F•BFÂ)FÂ7FÂ8FÃFÃ,FÄ	FÄ
FÄFÄAFÅ>FÆFÆFc                ó  € \        WR,          V4      e   R# ^ RIHp V P                  P	                  4       ;_uu_ 4       pVP                  RW1R,          ,           34      P                  4       RJuuRRR4       #   + '       g   i     R# ; i)z¯Whether the pin's admission may have committed: a live row, or a deleted target (its
admissions moved to retired receipts keyed by the route principal the pin never recorded).r4   NT)ÚRETIRED_PREFIXú$SELECT 1 FROM state_meta WHERE key=?)Ú_admission_atÚ hermes_state_mutation_retirementrb   ÚdbÚ	_read_ctxÚexecuteÚfetchone)rV   r$   Ú
request_idrb   Úconns   &&&  r(   rQ   rQ   ™   sn   € ô �Y |Õ 4°jÓAÒMÙÝ?Ø	�‰×	Ñ	×	!Ô	! TØ�|‰|ÐBØ+°\Õ.BÕBÐDóFßFNÁhÃjÐX\ð]÷ 
"×	!×	!Ó	!ús   Á 0A;Á;B	c                óÐ   € VP                  RVP                  R4      4      p\        V\        4      '       d$   \        V\        4      '       g   W P                  3# \        R4      R3# )z³``_migrate``'s FIFO key of a legacy ticket, or of the pin laid over one (it keeps the ticket's
fields). A pin without an integer order holds every legacy ticket until it resolves.ÚsequenceÚ
created_atz-infÚ )r   r   ÚintÚboolÚnameÚfloat)r#   r$   r_   s   && r(   rS   rS   ¤   sU   € ð �J‰J�z 6§:¡:¨lÓ#;Ó<€EÜ!+¨E´3×!7Ò!7Ä
È5ÔRV×@WÒ@WˆE—9‘9ÐÐpÔ^cÐdjÓ^kÐmoÐ]pÐpr7   c                 ó6  € ^ RI Hp \        V P                  P                  4      P
                  P                  4       pV! V4      pVP                  V P                  8w  g   Y%VR8X  d   RMT39  d   \        R4      hRVP                  9  d   \        R4      hV# )é    )Úserved_profile_nameÚdefaultÚhermesÚprofile_mismatchúsession:submitÚpermission_denied)
Úgateway.session_authoritiesrv   r   rf   Údb_pathÚparentÚresolveÚ
profile_idr	   Úcapabilities)rV   ÚactorÚprofilerv   rW   rr   s   &&&   r(   Ú_homer„   «   s‡   € Ý?Ü�	—‘×$Ñ$Ó%×,Ñ,×4Ñ4Ó6€DÙ˜tÓ$€DØ×Ñ˜9×/Ñ/Ô/°7ÐUYÐ]fÔUfÉÐlpÐBqÔ3qÜÐ 2Ó3Ð3Ø˜u×1Ñ1Ô1ÜÐ 3Ó4Ð4Ø€Kr7   c              ƒ   óÜ  "  € R pV P                   P                  R4      pVe   \        W4      ;pe   \        YVf   R MXR7      G R j  x€L
 pVf~   V P                   P                  R4      pV P                   P	                  VR,          4      pV P                   P                  V4      pVf   \        R4      h^ RIHp V! WVR,          4      pV P                  WR4       V P                  VP                  ,          pV P                  P                  P                  VP                  4      p	VP                   P"                  \$        P&                  8w  g   V	f   \        R4      hW(V	3#  EL 5i)NúBot Chat)ÚdisplaceÚidÚ	not_found)Úresolve_local_targetrz   Úadmission_conflict)rf   Úget_session_by_titleÚdisplaceable_bot_chatÚ_create_bot_chatÚget_compression_tipÚget_sessionr	   Úgateway.session_local_migrationrŠ   Ú	authorizeÚsessionsr4   ÚrunnerÚsession_storeÚlookup_by_session_keyÚrouteÚsourceÚplatformr   ÚLOCAL)
rV   r‚   ÚrefÚrowÚ	displacedÚtipÚtargetrŠ   ÚliveÚentrys
   &&        r(   Ú_targetr¢   ¶   s/  é € Ø
€CØ
�,‰,×
+Ñ
+¨JÓ
7€CØ
‚{Ô$9¸)Ó$IÐI�yÒVô % YÈÊÁÐYbÔc×cˆØ
‚{Ø�l‰l×/Ñ/°
Ó;ˆØ�l‰l×.Ñ.¨s°4­yÓ9ˆØ—‘×)Ñ)¨#Ó.ˆØŠ>Ü# KÓ0Ð0ÝHÙ" 9°V¸Dµ\ÓBˆØ×Ñ˜Ð$4Ô5Ø×Ñ˜cŸn™nÕ-€DØ×Ñ×*Ñ*×@Ñ@ÀÇÁÓL€EØ‡{�{×ÑœxŸ~™~Ô-°²ÜÐ 4Ó5Ð5Ø�eÐÐò dùs   ‚AE,Á	E)Á
D E,c           
     ó\  € ^ RI Hp ^ RIHp \	        VP                  R4      ;'       g    R4      P                  R4      '       d   R# V P                  pTP                  VP                  VR,          4      ;'       g
    VR,          4      pW3 Fÿ  pVe:   \	        VP                  R4      ;'       g    R4      P                  R4      '       d    R# \	        VP                  R4      ;'       g    R4      pVP                  4       ;_uu_ 4       pTP                  RY';'       g
    VR,          ,           Y7;'       g
    VR,          ,           34      P                  4       '       d    RRR4        R#  RRR4       \        WF4      '       g   Kþ   R# 	  VR,          #   + '       g   i     L1; i)	a  The id holding the canonical title when the Bot Chat is a conversation no FIFO can own (an
``api_`` row an older gateway or a plain ``POST /api/sessions`` minted, a messaging row, an
unbound CLI/TUI/Desktop row no native open can adopt), else None. Such a row can never be
adopted (``validate_legacy_row``), renamed (the canonical title is its identity) or renamed
over the API, so it would refuse every delivery for good. A bound local chat, old local history
a native open adopts and a local row a login stamped as its own are never moved.©ÚPOLICY_PREFIX)ÚLEGACY_PREFIXÚchat_idro   zlocal-Nrˆ   z+SELECT 1 FROM state_meta WHERE key IN (?,?))Úhermes_state_localr¥   Úhermes_state_local_migrationr¦   r   r   Ú
startswithrf   r�   r�   rg   rh   ri   Ú_kept_local_history)	rV   rœ   r¥   r¦   rf   rž   Ú	candidater§   rk   s	   &&       r(   r�   r�   Í   sK  € õ 1Ý:ä
ˆ3�7‰7�9Ó×#Ð# Ó$×/Ñ/°×9Ò9ÙØ	�‰€BØ
�.‰.˜×/Ñ/°°Dµ	Ó:×GÐG¸cÀ$½iÓ
H€CØ“Zˆ	ØÒ¤ I§M¡M°)Ó$<×$BÐ$BÀÓ C× NÑ NÈx× XÒ XÚÜ�i—m‘m IÓ.×4Ð4°"Ó5ˆØ�\‰\�^Œ^˜tØ�|‰|ÐIØ*×.HÐ.H¸À4½ÕIØ*×.HÐ.H¸À4½ÕIðKóLçLTÉHËJöWð ÷	 Š^ðW÷ ô
 ˜r×-Ô-Úñ  ð ˆt�9Ð÷ �^ús   Ä-FÄ<(FÅ%FÆF+c                óÎ   € ^ RI HpHpHp VP	                  R4      V9  d   R# VP	                  R4      '       d   V! V4      '       g   R#  V! W4       R#   \
         d     R# i ; i)a]  Whether an unbound row is local history the Bot Chat door must leave in place: a CLI, TUI
or Desktop row a native open adopts, or one a login stamped as its owner. A local-source row
no open can ever adopt (a route column left by a crash or reconnect, another profile's stamp)
is not: it held the title and refused every delivery for good (#141243).)ÚLEGACY_LOCAL_SOURCESÚlegacy_account_labelÚvalidate_legacy_rowr˜   FÚuser_idT)r©   r®   r¯   r°   r   r	   )rf   rœ   r®   r¯   r°   s   &&   r(   r«   r«   é   sc   € ÷
 mÑlØ
‡w�wˆxÓÐ 4Ô4ÙØ
‡w�wˆy×ÒÑ"6°s×";Ò";ÙðÙ˜BÔ$ñ øô ô Úðús   ÁA ÁA$Á#A$c                ó  € Vf   R# V P                   pW!R,          VP                  VR,          4      39  d   R# \        VP                  VR,          4      ;'       g    / P	                  R4      ;'       g    R4      P                  R4      # )aE  Whether *pinned*, the Bot Chat the producer discovered, is the title holder this delivery's
``_target`` just moved aside. The producer pins the id it read before asking, so the first
delivery after a move would otherwise be refused ``admission_conflict`` for the chat the door
itself replaced, and land only on the next beat.Frˆ   Útitlero   ú
Bot Chat ()rf   r�   r   r�   r   rª   )rV   ÚholderÚpinnedrf   s   &&& r(   Ú_moved_aside_by_this_doorr·   ú   su   € ð
 ‚~ÙØ	�‰€BØ˜T•l B×$:Ñ$:¸6À$½<Ó$HÐIÔIÙÜ�—‘˜v d�|Ó,×2Ð2°×7Ñ7¸Ó@×FÐFÀBÓG×RÑRÐS_Ó`Ð`r7   c                ó\  a aa€ \        S P                  S4      ;'       g    / P                  R4      ;'       g    R4      pVR
9   d   RMTpRV RS R2o\        S4      S P                  8”  d   SRS P                  ^,
           R,           oV VV3R	 lp\        S P                  V4      4      # )a  Free the canonical title from *sid*: it keeps its id and history under a visible name the
user can find, rename or delete: ``Bot Chat (API <id>)`` for an API conversation, else named by
its platform (``Bot Chat (telegram <id>)``). False when the title moved meanwhile.r˜   ro   ÚAPIr´   Ú Ú)Nu   â€¦)c                 óV   <€ V P                  R SSP                  S34      P                  # )zUUPDATE sessions SET title=?, title_source=?, hidden=0 WHERE id=? AND title='Bot Chat')rh   ÚTITLE_SOURCE_USERÚrowcount)rk   rf   rr   Úsids   &€€€r(   ÚwriteÚ!_displace_bot_chat.<locals>.write  s-   ø€ Ø�|‰|ÐsØ! 2×#7Ñ#7¸Ð=ó?ß?G¹xð	Hr7   )ro   Ú
api_serverÚbot_peer_dm)r   r�   r   ÚlenÚMAX_TITLE_LENGTHrq   Ú_execute_write)rf   r¿   r˜   ÚlabelrÀ   rr   s   ff   @r(   Ú_displace_bot_chatrÈ     s£   ú€ ô �"—.‘. Ó%×+Ð+¨×0Ñ0°Ó:×@Ð@¸bÓA€FØÐ@Ô@‰EÀf€EØ˜�w˜a ˜u AÐ&€DÜ
ˆ4ƒy�2×&Ñ&Ô&ØÐ,�R×(Ñ(¨1Õ,Ð-°Õ6ˆ÷Hô �×!Ñ! %Ó(Ó)Ð)r7   r‡   c             ƒ  óv  "  € RVP                   9  d   \        R4      h^ RIHpHp ^ RIHp ^ RIHp ^ RI	H
p ^ RIHp \        V RR	4      p	V	f   \        P                  ! 4       ;q�n        T	;_uu_4       GR	j  x€L
  V P"                  P%                  R
4      p
V
e�   Ve   V
R,          V8w  g   \'        W
4      V8w  d    R	R	R	4      GR	j  x€L
  R	# \(        P+                  RV4       V! V \-        \.        V P"                  V4      4      G R	j  x€L
 '       g    R	R	R	4      GR	j  x€L
  R	# \1        W4      pRVRRR\3        \4        P6                  ! 4       4      RR/pV! WV4      '       g   VP9                  R4       V! WV4      p\;        V\<        4      '       dA   V! V \-        W€P"                  V P>                  VR7      4      G R	j  x€L
  V! WR,          4      pV! V \-        W`VR
4      4      G R	j  x€L
  TuuR	R	R	4      GR	j  x€L
  #  EL’ ELC EL Lï LN L% L  + GR	j  x€L 
 '       g   i     R	# ; i5i)a@  No Bot Chat yet (or *displace*, an API conversation holding its title, is moved aside first): mint it the way ``hermes chat --in ~ -c "Bot Chat" --create-if-missing``
did on the CLI lane this door replaced, so a fresh profile's first delivery has somewhere
to land instead of being recorded as failed. Same owner step as ``session.create`` with a
title: lookup, creation and title run under the authority's titled-create lock, with the
commits off the owner loop (N90). Creation is the actor's own capability; a submit-only
principal (owner recovery) still gets ``not_found``.zsession:creater‰   )Ústage_local_sessionÚstaged_creation_follows)Úrestore_local_session)Útitle_new_session)Útracked_write)Úcommit_local_sessionÚ_titled_create_lockNr†   rˆ   zJBot Chat title held by %s, a conversation no FIFO can own: moving it asiderj   r˜   ÚcliÚcwdÚfollow_profile_configT)ÚepochÚreceiptr4   ) r�   r	   Úgateway.session_localrÊ   rË   Úgateway.session_local_recoveryrÌ   Úgateway.session_local_titlerÍ   Úgateway.session_runtime_workersrÎ   r¨   rÏ   ÚgetattrÚasyncioÚLockrÐ   rf   rŒ   r�   Úloggerr?   r   rÈ   Ú_bot_chat_creation_idr   r   rW   Úpopr   ÚdictrÔ   )rV   r‚   r‡   rÊ   rË   rÌ   rÍ   rÎ   rÏ   ÚlockÚheldrj   Úparamsr›   s   &&$           r(   rŽ   rŽ     sÀ  é € ð ˜u×1Ñ1Ô1Ü Ó,Ð,ßRÝDÝ=Ý=Ý7Ü�9Ð3°TÓ:€DØ‚|Ü/6¯|ª|«~Ð=ˆÔ,ß�tŠtØ�|‰|×0Ñ0°Ó<ˆØÒØÒ 4¨¥:°Ô#9Ô=RÐS\Ó=cÐgoÔ=oØ÷	 �t‰tô
 �N‰NÐgÐiqÔrÙ& y´'Ô:LÈiÏlÉlÐ\dÓ2eÓf×fÖfØ÷ �t‰tô +¨9Ó<ˆ
Ø 
¨H°e¸UÄCÌÏ	Ê	ËÓDTØ)¨4ð1ˆñ ' y¸×DÒDØ�J‰JÐ.Ô/Ù! )°FÓ;ˆÜ�cœ4× Ò Ù 	¬7Ð3GÏÉÐ]f×]lÑ]lÐvyÔ+zÓ{×{Ð{Ù'¨	°|Õ3DÓEˆCÙ˜I¤wÐ/@ÈSÐR\Ó']Ó^×^Ð^Ø÷+ �t�tˆtò gñ ñ$ |á^÷) �t�t‹tüsÈ   ‚A7H9Á9HÁ:H9Á=AHÃ H9ÃHÃH9Ã;HÄHÄ	HÄHÄH9Ä$HÄ%H9Ä+BHÇHÇ*HÇ2HÇ3HÇ8H9ÈHÈH9ÈH9ÈHÈH9ÈHÈHÈH9ÈH6	È"H%È#
H6	È.H6	È0	H9c                ó¨   a aaaa€ ^ RI Ho ^ RIHp RS P                  ,           oV3R loR pV! S P
                  VV VV3R lVR7      w  rES! V4      # )u(  The first creation identity whose session is not spent. Generation 0 keeps the historical
``bot-chat:<profile>`` id; a generation is spent once its session was deleted (retired: a retry
must never resurrect it) or renamed (titled, but not "Bot Chat" â€” or the lookup had found it),
and a replacement takes the next one. Derived from durable rows only, so a restart and two
concurrent deliveries (serialized by the titled-create lock) pick the same identity. An
existing UNtitled session is the same creation interrupted before its title: it is reused.)Úlocal_identity)Úfirst_generationz	bot-chat:c                 ó$   <€ V ^ 8X  d   S# S RV  2# )ru   Ú:© )Ú
generationÚbases   &€r(   Ú<lambda>Ú'_bot_chat_creation_id.<locals>.<lambda>J  s   ø€ ¨J¸!¬O DÐ$WÀDÀ6ÈÈ:È,ÐAWÐ$Wr7   c                 ó€   € V P                  R V34      P                  4       pVRJ;'       d    \        V^ ,          4      # )z%SELECT title FROM sessions WHERE id=?N)rh   ri   rq   )rk   r¿   rœ   s   && r(   ÚtitledÚ%_bot_chat_creation_id.<locals>.titledL  s8   € Ø�l‰lÐBÀSÀFÓK×TÑTÓVˆØ˜$ˆ×/Ð/¤4¨¨A­£<Ð/r7   c                 óL   <€ S! SP                   SP                  S! V 4      4      # ©N)r€   Úsubject)Únr‚   rV   rå   rj   s   &€€€€r(   rì   rí   P  s   ø€ ¡¨y×/CÑ/CÀUÇ]Á]ÑT^Ð_`ÓTaÔ br7   )Úspent)r×   rå   re   ræ   r€   rf   )	rV   r‚   ræ   rï   rê   Ú_sidrë   rå   rj   s	   ff    @@@r(   rÞ   rÞ   @  sM   ü€ õ >ÝAØ˜×-Ñ-Õ-€DÜW€Jò0ñ (Ø�‰×bÐjpôrÑ€Já�jÓ!Ð!r7   c                ó  € \        V P                  VR7      pVf   \        W4      # RRRRRRRRRR	R
R
R
/P                  VR,          R4      /VR,          ,          p^ RIHp V! V P                  V4      pT;'       g    / P                  RR4      pVeL   VR,          P                  RR4      pVR,          R8X  d   RMR
p^ RIHp VR8X  d   V! V4      '       d   RpWG3# Ve    VP                  R4      R9   d
   VR,          pWG3# )z_``(status, reply)`` of one admission, read from its committed result, never transcript recency.©r,   ÚqueuedÚstartedÚclaimedÚunknownr9   ÚterminalÚ	cancelledÚrejectedr-   Úoutcomer   ©Úadmission_resultÚreplyro   ÚresultÚfinal_responseÚ	completedÚsettled)Úis_intentional_silence_response>   r-   r  )r
   rf   Ú_expired_outcomer   Úgateway.session_resultsr  Úgateway.response_filtersr  )	rV   r,   Úfallbackrœ   r   r  Úsavedr  r  s	   &&&      r(   Ú_admission_outcomer  T  s)  € ä
 	§¡¸<Ô
H€CØ
‚{Ü 	Ó4Ð4ð ˜ )¨Y¸	À;Ø˜;¨°ZÀÈ8ÐU]Ð^×bÑbÐcfÐgpÕcqÐs~ÓðAð BEð  FNõ  BOõP€Få8Ù˜YŸ\™\¨<Ó8€EØ�^ˆ^˜× Ñ  ¨"Ó-€EØÒØ�h•×#Ñ#Ð$4°bÓ9ˆØ! )�n°Ô;‘Àˆõ 	MØ�YÔÑ#BÀ5×#IÒ#IØˆEð ˆ=Ðð 
Ò	 (§,¡,¨xÓ"8Ð<QÔ"QØ˜(Õ#ˆØˆ=Ðr7   c                ó  € ^ RI Hp T;'       g    / pVP                  R4      \        9   d   VR,          VP                  RR4      3# VP                  R4      pV'       d.   V! V P                  V4      '       d   RVP                  RR4      3# V'       dl   V P                  P                  V4      fO   \        P                  ! \        4      P                  RVP                  R4      V4       RVP                  RR4      3# \        R	4      h)
au  A receipt outlives its admission once a deleted target's tombstone passes the retry horizon
(``prune_retired_tombstones``). A final receipt keeps the answer it already holds; a pending one
whose session was deleted (retired, or its row gone) can never learn its outcome and becomes
``ambiguous``, never resent. A live session missing its admission is still a storage fault.)Úretired_sessionr   r  ro   r4   r9   zQBot delivery %s: session %s is gone with no deletion marker; settled as ambiguousr   Ústorage_unavailable)re   r  r   r   rf   r�   r<   r=   r>   r?   r	   )rV   r$   r  r4   s   &&  r(   r	  r	  o  sÝ   € õ
 AØ�\ˆ\�r€FØ‡z�z�(ÓœyÔ(Ø�hÕ §¡¨G°RÓ!8Ð8Ð8Ø—‘˜LÓ)€Jß‘o i§l¡l°J×?Ò?Ø˜FŸJ™J w°Ó3Ð3Ð3ß�i—l‘l×.Ñ.¨zÓ:ÒBô 	×Òœ(Ó#×+Ñ+Ø_Ø�J‰J�}Ó% zô	3ð ˜FŸJ™J w°Ó3Ð3Ð3Ü
Ð1Ó
2Ð2r7   c                óH   € \        WR,          \        VR,          4      4      # )z´The delivery's one retry admission id, read from the FIFO by its derived identity, so every
reader (an in-memory record, the receipt file, an owner restart) follows the same retry.r4   r   )rd   Ú_retry_identity)rV   r$   s   &&r(   Ú_retry_admissionr  …  s!   € ô ˜¨<Õ$8¼/È&ÐQ^ÕJ_Ó:`ÓaÐar7   c                 óæ   € V P                   P                  4       ;_uu_ 4       pVP                  R W34      P                  4       pRRR4       X'       d
   V^ ,          # R#   + '       g   i     L#; i)zVSELECT admission_id FROM session_admissions WHERE target_session_id=? AND request_id=?N)rf   rg   rh   ri   )rV   r4   rj   rk   rœ   s   &&&  r(   rd   rd   ‹  sY   € Ø	�‰×	Ñ	×	!Ô	! TØ�l‰lÐsØ&Ð3ó5ß5=±X³Zð 	÷ 
"÷ ˆ3ˆq�6Ð"˜dÐ"÷ 
"×	!ús   £"A Á A0	c                óV  € \        W4      pT;'       g
    VR,          pV'       d   \        W4      w  rEM\        WR,          V4      w  rER;rgVR8X  d    \        W4      w  rg\        WAR	,          VR
,          VR,          VR,          VR,          VW&VR7
      P                  4        U
Uu/ uF  w  r«Vf   K  W«bK  	  upp
#   \         dX   pTP                  R8w  d   h ^ RIHp	 TP                  R4      ;'       g    RTP                  R4      ;'       g    T	rv Rp?L»Rp?ii ; iu upp
i )a†  The delivery's receipt. Once the one transient-failure retry was admitted, the sender's
outcome is the retry's: ``status``/``reply`` follow it (``retry_admission_id``).

A ``failed`` receipt carries ``error`` + a typed ``reason`` (``tools.bot_failure_reasons``):
the relay's Desktop forwards ``res.reason`` to the sender, which cannot re-derive it from a
reply that lacks the provider text.r,   Nr-   r‰   )ÚUNKNOWNÚerrorúBot Chat delivery failedÚreasonr   r3   r4   r   )
r   r   r3   r4   r,   r   r  Úretry_admission_idr  r  )
r  r  Ú_failurer	   r  Útools.bot_failure_reasonsr  r   rà   Úitems)rV   r$   Úretry_idÚcurrentr   r  r  r  rJ   r  ÚkÚvs   &&          r(   Ú_resultr#  ’  s8  € ô   	Ó2€HØ×0Ð0˜& Õ0€GßÜ*¨9Ó?‰ˆ�ä*¨9¸^Õ6LÈfÓU‰ˆØÐ€EØ�Ôð	oÜ$ YÓ8‰MˆEô "¨ÀMÕ=RØ˜NÕ+¸¸|Õ8LØ˜NÕ+°V¸IÕ5FÈeØ#¸ôA÷ BGÁÃðIô [ñ I‘T�Qð MNô ˆAŠDñ Iò [ð [øô !ô 	oØ�z‰z˜[Ô(Øå9Ø"ŸJ™J wÓ/×MÐMÐ3MÈvÏzÉzÐZbÓOc×OnÐOnÐgn•6ûð	oüó[s0   ÁC  Â)D%Â6D%Ã D"Ã/DÃ;DÄDÄD"c           	     ób  € ^ RI Hp ^ RIHpHp V! V P
                  V4      ;'       g    / P                  R4      ;'       g    / pVP                  R4      ;'       g    VP                  R4      ;'       g    RpYc! V! VP                  R4      VP                  R4      4      ;'       g    T4      3# )zì``(error, reason)`` of a failed admission from its committed result: the raw provider error
and the turn loop's typed verdict, classified like every other Bot lane. A refusal that never
ran (no result) has no provider text: ``unknown``.r  )Úclassify_agent_errorÚturn_failure_textr  r  r  r  Úfailure_reason)r
  r  r  r%  r&  rf   r   )rV   r,   r  r%  r&  r  r  s   &&     r(   r  r  ¯  s”   € õ 9ßQÙ˜iŸl™l¨LÓ9×?Ð?¸R×DÑDÀXÓN×TÐTÐRT€EØ�I‰I�gÓ×[Ð[ %§)¡)Ð,<Ó"=×[Ð[ÐA[€EØÐ&Ñ'8¸¿¹À7Ó9KÈUÏYÉYÐWgÓMhÓ'i×'rÐ'rÐmrÓsÐsÐsr7   c                 ód   € \        W4      pVR ,          R8X  d   \        W4      '       d   RVR &   V# )r   r-   rû   )r#  Ú_retry_eligible)rV   r$   r  s   && r(   Ú_delivery_resultr*  º  s2   € Ü�YÓ'€FØˆhÕ˜8Ô#¬¸	×(JÒ(JØ$ˆˆxÑØ€Mr7   c                ó~  € ^ RI Hp \        W4      pV'       d   \        W4      ^ ,          R	9   d   VR3# R
# \        WR,          V4      ^ ,          pVR	9   d   VR,          R3# VR8X  dT   V! VR,          VR,          4      ;'       g    Tp\	        V / VCRVP                  R4      /C4      '       d   VR,          R3# R
# )a¼  ``(admission_id, interim)`` a live waiter must follow; ``(None, False)`` once the delivery
settled for good. The retry, once admitted, is the only admission whose future fires again.
An original that failed while its one retry is still eligible is ``interim``: pending, never
the answer, while the owner's receipt task admits the retry (or records why it would not;
the receipt file is re-read for that, the caller's in-memory record is stale).)Úread_delivery_resultFr,   r-   r3   r   ÚretryT>   rù   rû   )NF)r5   r,  r  r  r)  r   )rV   r$   r,  r  r   r  s   &&    r(   Úpeer_wait_admissionr.  Á  sÆ   € õ =Ü 	Ó2€HßÜ$6°yÓ$KÈAÕ$NÐRgÔ$g�˜%Ð ÐzÐmzÐzÜ 	°.Õ+AÀ6ÓJÈ1ÕM€FØÐ&Ô&Ø�nÕ% uÐ,Ð,Ø�ÔÙ$ V¨NÕ%;¸VÀMÕ=RÓS×]Ð]ÐW]ˆÜ˜9Ð&M¨Ð&M°¸%¿)¹)ÀGÓ:LÑ&M×NÒNØ˜.Õ)¨4Ð/Ð/ØÐr7   c                 ó"   € R V ,           R,           # )rM   z:retryré   ©r&   s   &r(   r  r  Õ  s   € Ø�C�<˜(Õ"Ð"r7   c                óˆ  € VP                  R4      ;'       g    / P                  R4      '       g   \        W4      '       d   R# \        V P                  VR,          R7      pVe   VR,          R8w  g   VR,          R	8w  d   R# ^ R
IHp V! V P                  VR,          4      pVf   R# ^ RIHpHp V! VR,          4      V8g  # )uR  Exactly the main-lane gate (``tools.bot_failure_reasons.result_retry_action``): the original
admission SETTLED ``failed`` with a committed result whose error classifies transient (429/5xx/
context overflow). queued/started/unknown admissions never qualify â€” unknown execution is never
replayed â€” and the retry itself is never retried.r-  r+   Fr,   rø   r   rý   r   r-   r  )Ú
RETRY_NONEÚresult_retry_actionr  )	r   r  r
   rf   r
  r  r  r2  r3  )rV   r$   rœ   r  r  r2  r3  s   &&     r(   r)  r)  Ù  sž   € ð
 	�
‰
�7Ó×!Ð!˜r×&Ñ& y×1Ò1Ô5EÀi×5XÒ5XÙÜ
 	§¡¸6À.Õ;QÔ
R€CØ
‚{�c˜(•m zÔ1°S¸µ^ÀxÔ5OÙÝ8Ù˜YŸ\™\¨6°.Õ+AÓB€EØ‚}ÙßIÙ˜u X�Ó/°:Ñ=Ð=r7   c           
   ƒ  ó&  "  € \        W4      '       g   R# \        VR,          4      pVP                  R4      RJ d   R0M	\        4       p\	        VR,          V P
                  \        RR0V,          4      R	4      p V P                  4        \        W4      G Rj  x€L
 w  rxp	VP                  VR
,          8w  d   \        R4      hV P                  P                  V	P                  4      R8X  d   \        R4      h \!        TR,          TP"                  RTRTP$                  RT	P                  /R7      p^ RIHp TP*                  P                  T! T4      4       TP                  R4      e    \-        TR,          4      TP*                  R&   RT/TR&   TP                  RRR7       \        Y4      G Rj  x€L
   T P/                  T P0                  P3                  TP"                  4      Y´4      G Rj  x€L
 pTP                  \5        Y4      4       TR,          R9   d   \7        YTR,          TP8                  4       \        Y4      G Rj  x€L
  \;        YT4       R#  ELÅ  \         d]   p
T
P                  R8X  d   TP                  RRR7        Rp
?
R# RTRT
P                  /TR&   \        Y4      G Rj  x€L 
   Rp
?
R# Rp
?
ii ; i EL LÛ  \         d1   p
T
P                  R8w  d   h TP                  RRR7        Rp
?
R# Rp
?
ii ; i LÂ5i) aÁ  Admit the delivery's one retry under a DERIVED identity recorded on the same receipt, so a
repeated deliver(), an owner restart or a second settle re-reads that admission instead of
minting another. The identity is written before the admission: a death in that two-store window
re-admits the SAME identity, which the FIFO answers with the existing row (never a second turn).

No user-row adoption: a transient owner-side failure persists the DM row and then CLOSES it with the
durable failed-turn boundary (``agent.conversation_loop._close_durable_failed_turn`` /
``_hmwa_close_failed_turn``, #107070), so ``agent.session_persistence.adopt_unanswered_turn`` would
decline by contract (a plain assistant row follows the DM) and the retry is a fresh turn after that
boundary. A failure that left the DM as an OPEN tail (the context-pressure classes skip the closer)
is not retried: the owner execution has no adoption seam, and the retry's DM would merge into it.Nr   ÚoperatorTúsession:operatorr.   rz   úsession:readzbot-delivery-retryr4   r‹   ÚuserÚopen_user_tailÚruntime_drainingrû   ro   )r   r  Úidentityr+   r-  r   Úgateway_session_keyÚgateway_session_id©Útextr˜   ÚinternalÚ
message_idÚmetadata©Ú automation_notification_metadataÚauthorÚturn_authorrù   Ú
queue_fullr   >   rù   rû   )r)  r  r   Úsetr   r€   Ú	frozensetÚ_require_admission_openr¢   r4   r	   rf   Úlatest_conversation_roler  Úupdater   r   r˜   r—   Úgateway.session_automationrD  rB  rà   Úadmit_automationr”   Ú_adapter_for_sourcer#  Ú_watch_replyr,   r   )rV   rW   r#   r$   r;  r5  r‚   r›   r    r¡   rJ   ÚeventrD  rÕ   s   &&&&          r(   Ú_maybe_retryrR  ë  s¬  é € ô ˜9×-Ò-ÙÜ˜v mÕ4Ó5€Hð (.§z¡z°*Ó'=ÀÓ'EÐ"Ñ#Ì3Ë5€HÜ�f˜^Õ,¨i×.BÑ.BÜÐ!1°>Ð BÀXÕ MÓNÐPdóf€EðØ×)Ñ)Ô+Ü!(¨Ó!:×:Ñˆ�5Ø�>‰>˜V LÕ1Ô1Ü#Ð$8Ó9Ð9Ø�<‰<×0Ñ0°×1AÑ1AÓBÀfÔLÜ#Ð$4Ó5Ð5ð Mô ˜f YÕ/¸¿¹ÈdØÐ'<¸d¿j¹jÐJ^Ð`e×`pÑ`pÐ&qôs€EåKØ	‡N�N×ÑÑ:¸6ÓBÔCØ‡z�z�(ÓÒ'Ü(,¨V°HÕ-=Ó(>ˆ�‰�}Ñ%Ø! 8Ð,€Fˆ7�OØ
‡M�M˜¨€MÔ,Ü
˜Ó
%×%Ð%ðØ!×2Ñ2°9×3CÑ3C×3WÑ3WÐX\×XcÑXcÓ3dÐfkÓv×vˆð ‡M�M”'˜)Ó,Ô-ØˆhÕÐ0Ô0Ü�Y f¨]Õ&;¸W×=QÑ=QÔRÜ
˜Ó
%×%Ð%Ü�Y fÖ-òI ;øô
 ô Ø�:‰:Ð+Ô+ð �M‰M °"ˆMÔ5ÝØ% x°¸C¿J¹JÐGˆˆw‰Ü˜DÓ)×)Ñ)Ýûðúò" &ávøÜô Ø�:‰:˜Ô%Øð 	�‰˜Y¨bˆÔ1Ýûðúñ &ùs±   ‚A9LÁ<I" ÂIÂAI" Ã:B;LÆ5KÆ6LÆ;8K Ç3KÇ4K Ç8ALÉLÉLÉI" É"K	É-$KÊLÊ!KÊ8J;Ê9KÊ>LËK	Ë	LËK ËLË%LÌLÌLÌLc              ƒ   óp  "  € R p \         P                  ! V4      G Rj  x€L
  \        V 4      ;_uu_4       GRj  x€L
  \	        W4      G Rj  x€L
 w  rVVf    RRR4      GRj  x€L
  R# WR R2,          pVP                  \        W4      4       V'       g   \        WWv4      G Rj  x€L
  VP                  \        W4      4       \        W4      G Rj  x€L
  \        WV4       RRR4      GRj  x€L
  R#  LØ  \         d    Rp Låi ; i LÑ LÀ L« Lj L? L%  + GRj  x€L 
 '       g   i     R# ; i5i)FNTú.json)rÛ   Úshieldr	   r   r   rL  r#  rR  r*  r   r   )rV   rW   r&   ÚfutureÚpausedrH   r$   r#   s   &&&&    r(   Ú_record_replyrX  )  sú   é € Ø€FðÜ�nŠn˜VÓ$×$Ð$ô
 ˜I×&×&Õ&Ü)¨$Ó4×4‰ˆØŠ>Ø÷ '×&Ñ&ð ˜˜U�mÕ#ˆØ�‰”g˜iÓ0Ô1ßÜ˜y°Ó=×=Ð=Ø�‰Ô& yÓ9Ô:Ü˜DÓ)×)Ð)Ü˜¨&Ô1÷ '×&Ñ&ñ 	%øÜô ð Šðúñ 'Ù4ñ 'ñ >á)÷ '×&×&Ó&üsÐ   ‚D6†C: ŸC8 C: ¤D6»D¼D6¿DÁDÁDÁD6Á%DÁ&D6Á,<DÂ(DÂ),DÃDÃDÃ&D6Ã1DÃ2D6Ã8C: Ã:D
ÄD6Ä	D
Ä
D6ÄDÄD6ÄDÄDÄD6ÄD3	ÄD"Ä 
D3	Ä+D3	Ä-	D6c           
   ƒ   ó2  "  € \        V 4      ;_uu_4       GR j  x€L
  \        W4      G R j  x€L
 w  r4Vf    R R R 4      GR j  x€L
  R # VP                  \        W4      4       VR,          R9   d-   \	        YY$P                  R4      ;'       g
    VR,          4       \        WW2 R2,          V4      G R j  x€L
  \        W4      G R j  x€L
  \        WV4       R R R 4      GR j  x€L
  R #  LÓ LÂ L­ L; L* L  + GR j  x€L 
 '       g   i     R # ; i5i)Nr   r  r,   rT  >   rù   rû   )	r   r   rL  r#  rP  r   rR  r   r   )rV   rW   r&   rH   r$   s   &&&  r(   Úrefresh_receiptrZ  >  sÖ   é € Ü˜I×&×&Õ&Ü)¨$Ó4×4‰ˆØŠ>Ø÷ '×&Ñ&ð 	�‰”g˜iÓ0Ô1Ø�(ÕÐ4Ô4Ü˜¨#¯z©zÐ:NÓ/O×/iÐ/iÐSYÐZhÕSiÔjÜ˜9¨D°U¸%°=Õ,@À&ÓI×IÐIÜ˜DÓ)×)Ð)Ü˜¨&Ô1÷ '×&Ó&Ù4ñ 'ñ 	JÙ)÷ '×&×&Ó&üsœ   ‚DšC.›DžC:­C0®C:¹DÁC2ÁDÁA-C:Â8C4Â9C:ÃC6ÃC:ÃDÃ'C8Ã(DÃ0C:Ã2DÃ4C:Ã6C:Ã8DÃ:D	Ä DÄ
D	ÄD	Ä	Dc           
      óê  € V P                   V P                  rC^ RIHpHp V! V4       \        VP                  P                  4      P                  P                  4       pV! V4      p\        W4V4       RVP                  9  d   \        R4      hRR0R\        4       R0 Rm/p	\        V4      W‘,          ,
          '       d   \        R4      h^ RIHp
HpHp VR8X  d   RV
! WrP%                  R4      4      /# VR8X  d   RV! V4      /#  V! WrP%                  R4      VP%                  RR4      VP%                  R	R4      VP%                  R
R4      R7       RR/#   \&         d   p\        R4      ThRp?ii ; i)ru   )Úrequire_servingrv   zsession:controlr{   ÚrosterÚagentsÚoutboxr  rˆ   r  r  Úinvalid_params)Úwrite_remote_rosterÚclaim_pending_envelopesÚwrite_replyÚcountÚ	envelopesro   )r  r  r  r‹   NÚokT>   rˆ   r  r  r  )rV   r‚   r|   r\  rv   r   rf   r}   r~   r   r„   r�   r	   rH  Útools.bot_relayra  rb  rc  r   r    )Ú
connectionÚ	operationrã   rV   r‚   r\  rv   rW   rr   Úfieldsra  rb  rc  rJ   s   &&&           r(   Úrelay_operationrk  K  sT  € Ø!×+Ñ+¨Z×-=Ñ-=ˆußPÙ�IÔÜ�	—‘×$Ñ$Ó%×,Ñ,×4Ñ4Ó6€DÙ˜tÓ$€DÜ	ˆ)˜DÔ!Ø × 2Ñ 2Ô2ÜÐ 3Ó4Ð4Ø˜˜
 H¬c«e°WÒ>`Ða€FÜ
ˆ6ƒ{�VÕ&×&Ô&ÜÐ 0Ó1Ð1ßYÑYØ�HÔØÑ,¨T·:±:¸hÓ3GÓHÐIÐIØ�HÔØÑ4°TÓ:Ð;Ð;ð?Ù�DŸ*™* TÓ*°&·*±*¸WÀbÓ2IØ Ÿ*™* W¨bÓ1¸&¿*¹*ÀXÈrÓ:Rõ	Tð �$ˆ<Ðøô ô ?ÜÐ 4Ó5¸3Ð>ûð?ús   ÄAE ÅE2Å!E-Å-E2c              ƒ   ó
  "  € \        W4      G R j  x€L
 w  r4pV UUu. uFZ  w  rgV'       g   K  RV9   g   K  VP                  R4      '       d   K1  VR,          R9   g   KA  Ve   \        Wg4      V8  g   KW  Wg3NK\  	  pppV'       g   R # \        W4      G R j  x€L
 w  ršp\	        VR R7       EF*  w  rgVR,          pVR,          \        V4      8w  d   K(  V P                  P                  VR,          4      VP                  8w  d   K[  ^ R	I	H
p V! VR,          VR
7      ;_uu_ 4       pV'       d   \        R4      h R R R 4       VR,          R8X  d+   VP                  RRR7       \        W'RR7      G R j  x€L
  KÏ  \        WW#\        VR,          4      VR,          WšV\!        VP                  R4      4      VVP                  RR4      R7      G R j  x€L
  EK-  	  R #  ELÏu uppi  ELP  + '       g   i     L¶; i L‡ L,5i)Nr0   r,   r   rû   c                 ó   € \        V !  # rò   )rS   )Úitems   &r(   rì   Ú_migrate.<locals>.<lambda>o  s	   € ¼ÀtÒ8Lr7   r0  r3   r4   )Úactive_session_liveness_guard)Úregistry_homeÚruntime_coordination_requiredr9   Úunknown_execution)r   r  ©Úexpectr   r   rE  Únotification_categoryr  )rE  r\   rv  >   rù   rû   )r`   r   rS   r¢   Úsortedr   rf   r�   r4   Úhermes_cli.active_sessionsrp  r	   rL  r   Ú_admitr   r   )rV   r‚   rW   rH   rY   rX   r#   r$   r\   r›   r    r¡   r0   rp  Úactives   &&&&           r(   Ú_migrater{  d  sà  é € ô $8¸	Ó#H×HÑ€D�7Ù18ô N±¡ Üô Ø# vÑ-ô Ø6<·j±jÀ×6Pô à˜Õ"Ð&;Ñ;ô ð ’?¤m°DÓ&AÀGÑ&Kô ˆt‹n±€Fñ N÷ ÙÜ$ YÓ6×6Ñ€CˆuÜ˜vÑ+L×MÐM‰ˆØ�w•ˆØ�Õ ¤C¨£IÔ-ÙØ�<‰<×+Ñ+¨E°,Õ,?Ó@ÀE×DTÑDTÔTÙÝLÙ*¨5°Õ+>Èd×SÕSÐW]ßÜ'Ð(GÓHÐHð ÷ Tð �(Õ˜yÔ(Ø�M‰M Ð5HˆMÔIÜ °YÔ?×?Ð?ÙÜ�Y t´<ÀÀ}Õ@UÓ3VØ˜IÕ&¨°5ÔARÐSY×S]ÑS]Ð^fÓSgÓAhÐqwØ+1¯:©:Ð6MÈxÓ+XôZ÷ 	Zó 	Zó Nò IùóNò 7÷ T×Súñ
 @ñ	Zùs€   ‚H‘G ’HžG#¯G#¸G#ÁG#Á!G#Á7G#Á>HÂG)ÂBHÄ)G,Ä>9HÅ7G?Å8AHÇHÇHÇ#HÇ,G<Ç7	HÈHc              ƒ  óÎ  "  € \        V P                  P                  4      P                  P	                  4       p\        V 4      ;_uu_4       GRj  x€L
  \        W4      G Rj  x€L
 w  r#pV Fã  w  rVV'       d7   VP                  R4      \        V4      8w  g   VP                  R4      '       g   KE   VP                  \        W4      4       VR,          R9   d5   \        YVR,          VP                  R4      ;'       g
    VR,          4       VR,          R9  d   \        WWV4      G Rj  x€L
  \'        Y4      G Rj  x€L
  \)        YT4       Kå  	  V P                  P+                  R
4      pVf    RRR4      GRj  x€L
  R# V P                  P-                  V P                  P/                  VR,          4      4      p	V	f    RRR4      GRj  x€L
  R# ^ RIHp
 V P                  P5                  4       ;_uu_ 4       pTP7                  RY©P                  R4      ;'       g
    V	R,          ,           34      P9                  4       pRRR4       X'       g    RRR4      GRj  x€L
  R# \;        V	R,          V P<                  \?        RR04      R4      p\A        WW4      G Rj  x€L
  RRR4      GRj  x€L
  R#  ELk EL[ EL•  \         dT   p\        P                  ! \         4      P#                  RTP                  R4      TP$                  TRR	7        Rp?EK°  Rp?ii ; i ELæ EL© ELZ  + '       g   i     Lî; i LÜ Lž L�  + GRj  x€L 
 '       g   i     R# ; i5i)zIRebuild derivative replies and queued legacy admissions at owner startup.Nr3   r,   r   r   r  z&Bot delivery %s not recovered: %s (%s)T)Úexc_infor†   rˆ   r¤   rc   r§   r±   rz   r7  zbot-owner-recovery>   rù   rû   )!r   rf   r}   r~   r   r   r`   r   r   rL  r#  rP  rR  r	   r<   r=   r>   r  r  r   r   rŒ   r�   r�   r¨   r¥   rg   rh   ri   r   r€   rI  r{  )rV   rW   rH   rY   Ú_r#   r$   rJ   rœ   rŸ   r¥   rk   Úboundr‚   s   &             r(   Úrecover_bot_deliveriesr€  ‚  s¦  é € ä�	—‘×$Ñ$Ó%×,Ñ,×4Ñ4Ó6€DÜ˜I×&×&Õ&Ü!5°iÓ!F×FÑˆ�qÛ#‰LˆDß˜VŸZ™Z¨Ó7¼3¸t»9ÔDÈFÏJÉJÐWe×LfÒLfÙðØ—‘œg iÓ8Ô9Ø˜(Õ#Ð'<Ô<Ü  °&¸Õ2GØ!'§¡Ð,@Ó!A×![Ð![ÀVÈNÕE[ô]à˜(Õ#Ð+@Ô@Ü& y¸ÓE×EÐEô   Ó-×-Ð-Ü˜Y¨fÖ5ñ% $ð& �l‰l×/Ñ/°
Ó;ˆØŠ;Ø÷/ '×&Ñ&ð0 —‘×)Ñ)¨)¯,©,×*JÑ*JÈ3ÈtÍ9Ó*UÓVˆØŠ>Ø÷5 '×&Ñ&õ6 	5Ø�\‰\×#Ñ#×%Ô%¨Ø—L‘LÐ!GØ§*¡*¨YÓ"7×"GÐ"G¸6À$½<ÕHÐJóLßLTÉHËJð ÷ &÷ Ø÷A '×&Ñ&ôB ˜& Õ+¨Y×-AÑ-AÜ#Ð%5°~Ð$FÓGÐI]ó_ˆä�y¨Ó4×4Ð4÷G '×&Ô&ÚFò FøÜ$ô ô ×!Ò!¤(Ó+×1Ñ1Ð2ZØ28·*±*¸]Ó2KÈSÏZÉZÐY]Ðhlð 2ô næûðúò .õ' '÷8 &×%úñ9 'ñF 	5÷G '×&×&Ó&üsC  ‚AM%ÁJ<ÁM%ÁMÁ$J?Á%AMÂ1MÂ4AKÄ+KÄ-K
Ä.KÄ2MÅ L&
Å4MÅ5M%Æ L)ÆM%ÆA MÇM%ÇL,ÇM%Ç(MÈAL/	É	MÉMÉM%É%MÉ&M%É,9MÊ%MÊ&MÊ*M%Ê5MÊ6M%Ê?MËKËL#	ËAL	ÌMÌL#	Ì#MÌ)M%Ì,M%Ì/L?Ì:MÍM%ÍMÍM%ÍM"	ÍMÍ
M"	ÍM"	Í	M%c                 óÜ  aaaa€ \        V R R4      oSf
   / ;oV n        SP                  S4      pVe.   V^ ,          S8X  d    V^,          P                  4       '       g   R# V P                  P                  S\        P                  ! 4       P                  4       4      o\        P                  ! \        WSS4      4      pSVS3SS&   VVVV3R lpVP                  V4       \        W4       R# )Ú_bot_reply_watchersNc                 ób   <€ SP                  S4      SV S38X  d   SP                  SR 4       R # R # rò   )r   rß   )Úfinishedr,   rV  r&   Úwatcherss   &€€€€r(   ÚdoneÚ_watch_reply.<locals>.doneµ  s/   ø€ Ø�<‰<˜Ó ¨x¸Ð @Ô@Ø�L‰L˜˜dÖ#ñ Ar7   )rÚ   r‚  r   r†  ÚwaitersÚ
setdefaultrÛ   Úget_running_loopÚcreate_futureÚcreate_taskrX  Úadd_done_callbackr   )	rV   rW   r&   r,   ÚpreviousÚtaskr†  rV  r…  s	   &&ff   @@r(   rP  rP  «  sÎ   û€ Ü�yÐ"7¸Ó>€HØÒØ35Ð5ˆ�9Ô0Ø�|‰|˜CÓ €HØÒ ¨¥¨|Ô ;ÀHÈQÅK×DTÑDT×DVÒDVÙØ×Ñ×)Ñ)¨,¼×8PÒ8PÓ8R×8`Ñ8`Ó8bÓc€FÜ×Òœ}¨Y¸cÀ6ÓJÓK€DØ! 4¨Ð0€HˆS�M÷$ð $ð 	×Ñ˜4Ô Ü�yÖ'r7   c           	   ƒ   ó¾   "  € ^ RI Hp V P                  P                  4        \        P
                  ! V! V P                  \        W4      4      4      G Rj  x€L
 #  L5i)ru   ©Útrack_mutationN)rÙ   r’  rV   rJ  rÛ   rU  Ú_deliver)rh  rã   r’  s   && r(   Údeliverr”  ¼  sA   é € Ý>Ø×Ñ×0Ñ0Ô2Ü—’¡¨z×/CÑ/CÄXÈjÓEaÓ bÓc×cÐcÑcùs   ‚AAÁAÁAc                óÂ   € V R,          V8w  gF   V R,          VP                   8w  g.   V P                  R4      V8w  g   V P                  RR4      V8w  d   \        R4      hR# )z§A delivery id names one delivery: the same message, principal, author and category (the
mailbox writer's identity), whether its receipt is admission-backed or refused.r   r.   rE  rv  r  r‹   N)ró   r   r	   )r$   r‚   r   rE  Úcategorys   &&&&&r(   Ú_require_same_deliveryr—  Â  sX   € ð 	ˆyÕ˜WÔ$¨¨~Õ(>À%Ç-Á-Ô(OØ�z‰z˜(Ó# vÔ-Ø�z‰zÐ1°8Ó<ÀÔHÜÐ 4Ó5Ð5ñ Ir7   c                óà  € \        WVP                  R4      4      p\        V4      0 R
m,
          '       d   \        R4      h^ RIHp V! V4      pVP                  RR4      p \        VP                  R4      4      pTP                  R4      p	TP                  R4      e   \        M\        p
\        T	\        4      '       d'   T	P                  4       '       d   \        T	4      T
8”  d   \        R4      h\        TP                  R4      4      pTP                  R4      e-   \        TR,          \        4      '       d   Tf   \        R4      hY7Y›T3#   \         d   p\        R4      ThR	p?ii ; i)z–``(home, key, message, author, category)`` of one ``deliver``/``settle`` request: the
delivery's full identity, validated the same way for both verbs.rƒ   rˆ   r   rE  rv  r`  rC  r  N>   rˆ   rE  r   rƒ   r4   rv  )r„   r   rH  r	   rM  rD  r   r    Ú_BOT_DM_MAX_CHARSÚ_PRODUCER_MAX_CHARSr   r   ÚstriprÄ   r   rà   )rV   r‚   rã   rW   rD  Únotificationr–  r&   rJ   r   ÚlimitrE  s   &&&         r(   Ú_delivery_paramsrž  Ë  s6  € ô � 6§:¡:¨iÓ#8Ó9€DÜ
ˆ6ƒ{Òb×bÔbÜÐ 0Ó1Ð1ÝKÙ3°FÓ;€LØ×ÑÐ 7¸ÓB€Hð;Ü˜6Ÿ:™: dÓ+Ó,ˆð �j‰j˜Ó#€Gð "(§¡¨HÓ!5Ò!AÕÔGZ€EÜ�gœs×#Ò#¨7¯=©=¯?ª?¼cÀ'»lÈUÔ>RÜÐ 0Ó1Ð1Ü˜vŸz™z¨(Ó3Ó4€FØ‡z�z�(ÓÒ'´¸FÀ8Õ<LÌd×1SÒ1SÐW]ÒWeÜÐ 0Ó1Ð1Ø�g xÐ/Ð/øô ô ;ÜÐ 0Ó1°sÐ:ûð;ús   Á"E ÅE-ÅE(Å(E-c                 ó<   € R Uu/ uF  qW,          bK  	  up# u upi )r   )	r   r+   r   r3   r4   r   r  r  r  ré   )r$   r!  s   & r(   Ú_refused_answerr   å  s5   € ñ#Jó Kñ #J˜Qˆv�yŠLñ #Jñ Kð Kùò Ks   …c              ƒ  óˆ  "  € Ve-   VP                  R4      '       g   VP                  R4      RJ g   R# \        W1.VO5!   VP                  R4      '       g   \        V4      # V P                  V\	        V P
                  VR,          4      R4       Ve   \        WWS4      G Rj  x€L
  \        WV4      G Rj  x€L
 #  L L5i)a  The answer an id's existing receipt gives, or None when it has none yet: an admitted id's
published result (after its one retry when ``retry_path`` is given), or a terminal refusal
(``refuse_pin``, ``settle``), which is the id's answer for good. Both check the identity.Nr,   r+   Tr4   rz   )r   r—  r   r’   r   r€   rR  Ú_publish_result)rV   r‚   rW   r$   r;  Ú
retry_paths   &&&&&&r(   Ú_receipt_answerr¤  ê  s©   é € ð ‚~˜fŸj™j¨×8Ò8¸F¿J¹JÀyÓ<QÐUYÓ<YÙÜ˜6Ð4¨8Ô4Ø�:‰:�n×%Ò%Ü˜vÓ&Ð&Ø×Ñ˜œz¨)×*>Ñ*>ÀÀ|Õ@TÓUÐWgÔhØÒÜ˜9¨JÓ?×?Ð?Ü  °&Ó9×9Ð9ñ 	@Ù9ùs)   ‚CžBCÂ%B>Â&CÂ9C Â:CÃ Cc              ƒ   óH  "  € V P                   V P                  r2\        W#V4      w  rErgpWgV3p	VP                  4        \	        V4      ;_uu_4       GR j  x€L
  \        WE4      G R j  x€L
 w  r«W¥ R2,          p\        W#WKWœR7      G R j  x€L
 pVe   TuuR R R 4      GR j  x€L
  #  \        W#WJ4      G R j  x€L
  \        WE4      G R j  x€L
 w  rë\        W#WKWœR7      G R j  x€L
 pVe   TuuR R R 4      GR j  x€L
  # Ve   \        R4      hVP                  P                  R4      p\        W#4      G R j  x€L
 w  pppVP                  RVP                  4      pVVP                  8w  d   \        W/V4      '       g   \        R4      h\        W#WJWVVVVVVR7      G R j  x€L
 uuR R R 4      GR j  x€L
  #  ELc ELS EL3 EL EL Lû Lå LÐ L” L- L  \         d%   p\!        YET4      G R j  x€L 
 ;'       g    ThR p?ii ; i  + GR j  x€L 
 '       g   i     R # ; i5i)NrT  )r£  rs  r†   r4   r‹   )rE  rv  )rV   r‚   rž  rJ  r   r   r¤  r{  r	   rf   rŒ   r¢   r   r4   r·   ry  Ú_held_by_another_writer)rh  rã   rV   r‚   rW   r&   r   rE  r–  r;  rH   r$   r#   Úanswerr~  rµ   r›   r    r¡   r¶   rJ   s   &&                   r(   r“  r“  ù  së  é € Ø!×+Ñ+¨Z×-=Ñ-=ˆuÜ+;¸IÈfÓ+UÑ(€Dˆw Ø Ð*€HØ×%Ñ%Ô'Ü˜I×&×&Õ&Ü)¨$Ó4×4‰ˆØ˜˜U�mÕ#ˆÜ& y¸ÀxÔa×aˆØÒØ÷ '×&Ò&ð	GÜ˜9¨TÓ8×8Ð8Ü*¨4Ó5×5‰IˆAÜ*¨9¸TÈ8Ôe×eˆFØÒ!Ø÷ '×&Ò&ð Ò!Ü'Ð(;Ó<Ð<Ø—\‘\×6Ñ6°zÓBˆFÜ%,¨YÓ%>×>ÑˆC��uØ—Z‘Z ¨e×.>Ñ.>Ó?ˆFØ˜×)Ñ)Ô)Ô2KÈIÐ_e×2fÒ2fÜ'Ð(<Ó=Ð=Ü 	°$¸cÈCÐQUÐW\ÐekØ6>ô@÷ @÷' '×&Õ&Ú4âaò 'ò 9Ù5Ùeñ 'ñ  ?ñ@ñ' 'øô* !ô 	GÜ/°¸3Ó?×?Ð?×FÐFÀ3ÐFûð	Gú÷+ '×&×&Ñ&üs3  ‚AH"ÁF8ÁH"ÁHÁ(F;Á)"HÂF>Â	HÂH"Â"GÂ#H"Â)GÂ8GÂ9GÃGÃGÃ#G	Ã$	GÃ-H"Ã:GÃ;H"Ä 8GÄ8GÄ9A(GÆ!GÆ"GÆ%H"Æ2GÆ3H"Æ;HÆ>HÇH"ÇGÇGÇ	GÇH"ÇGÇGÇH"ÇHÇG=Ç-G0
Ç.G=Ç:G=Ç=HÈHÈH	ÈHÈ
H	ÈH	È	H"c           	   ƒ   óî   "  € ^ RI Hp ^ RIHp V! V P                  4       V P                  P                  4        \        P                  ! V! V P                  \        W4      4      4      G Rj  x€L
 #  L5i)ru   )r\  r‘  N)	r|   r\  rÙ   r’  rV   rJ  rÛ   rU  Ú_settle)rh  rã   r\  r’  s   &&  r(   Úsettlerª    sT   é € Ý;Ý>ñ �J×(Ñ(Ô)Ø×Ñ×0Ñ0Ô2Ü—’¡¨z×/CÑ/CÄWÈZÓE`Ó aÓb×bÐbÑbùs   ‚A,A5Á.A3Á/A5c              ƒ  óB  "  € V P                   V P                  r2\        W#V4      w  rErgp\        V4      ;_uu_4       GRj  x€L
  \	        WE4      G Rj  x€L
 w  ršV
fS   \        W#WEWgV4      p
\        WJ4      G Rj  x€L
  \        P                  ! \        4      P                  RWZR,          4       \        W£WgV4       \        W#WJWgV34      G Rj  x€L
 pVf   \        R4      hTuuRRR4      GRj  x€L
  #  L¶ L¥ L€ L- L  + GRj  x€L 
 '       g   i     R# ; i5i)a  Finalize a delivery the sender was told may not have been admitted: under the mailbox lock
every ``_admit`` holds, either settle the id as never sent or answer with what it already is.

A ``deliver`` refusal marked ``admitted=False`` proves absence only while that request held
the lock; a same-id attempt may admit right after. The sender calls this before it says "NOT
sent": with no receipt and no admission row for ``bot:<id>``, a terminal ``refused`` receipt
bound to the full identity is written, and every later ``deliver`` of the id answers with it
instead of admitting. An admitted id gets its receipt; an in-flight pin stays unknown. Only the
Bot DM tool calls this, so cron's same-id retries of a refusal are unchanged.

The writer is not re-checked: it may release between the refusal and this call, and "nothing
was admitted" is all that is serialized here. So the receipt claims only that, and any
``session:submit`` principal of the profile can settle an id it never delivered: the trust
``deliver`` already grants it over that id.Nz-Bot Chat delivery %s settled as not sent (%s)r  rs  )rV   r‚   rž  r   r   Ú_not_sent_recordr   r<   r=   r>   rU   r—  r¤  r	   )rh  rã   rV   r‚   rW   r&   r   rE  r–  r~  r$   r§  s   &&          r(   r©  r©  !  sï   é € ð "×+Ñ+¨Z×-=Ñ-=ˆuÜ+;¸IÈfÓ+UÑ(€Dˆw Ü˜I×&×&Õ&Ü& tÓ1×1‰	ˆØŠ>Ü% i¸À7ÐT\Ó]ˆFÜ Ó-×-Ð-Ü×ÒœhÓ'×,Ñ,Ð-\Ð^aÐjrÕcsÔtÜ˜v¨g¸xÔHÜ& y¸ÈÐYaÐGbÓc×cˆØŠ>Ü#Ð$7Ó8Ð8Ø÷ '×&Ô&Ù1ñ .ñ d÷ '×&×&Ó&üs„   ‚?DÁC8ÁDÁDÁC:Á&DÁ;C<Á<ADÃC>ÃDÃ%DÃ2D Ã3DÃ:DÃ<DÃ>DÄ DÄD	ÄDÄ	
D	ÄD	Ä	Dc                ó(  € V P                   P                  4       ;_uu_ 4       pVP                  RRV,           34      P                  4       pRRR4       V P                   P	                  R4      p	Xf   V	f   \        R4      h^ RIHp
 \        V\        V4      V P                   P                  V	R,          4      VP                  VRR	R
R\        R7
      pVP                  V
! RV/4      4       Ve   \        V4      VR&   V#   + '       g   i     L½; i)z¥The never-admitted id's terminal receipt, in ``refuse_pin``'s shape. Refuses (unknown) when
the FIFO holds a ``bot:<id>`` row anyway or there is no Bot Chat to name.z3SELECT 1 FROM session_admissions WHERE request_id=?rM   Nr†   rs  rC  rˆ   r-   Tro   z2Settled as not sent after a session-writer refusal)
r   r3   r4   r.   r   r   r+   r  r  r  rv  rE  )rf   rg   rh   ri   rŒ   r	   rM  rD  rà   r   r�   ró   r   rL  )rV   r‚   rW   r&   r   rE  r–  rk   Úadmittedrœ   rD  r$   s   &&&&&&&     r(   r¬  r¬  ?  sí   € ð 
�‰×	Ñ	×	!Ô	! TØ—<‘<Ð UÐX^ÐadÕXdÐWfÓg×pÑpÓrˆ÷ 
"à
�,‰,×
+Ñ
+¨JÓ
7€CØÒ˜sš{ÜÐ 3Ó4Ð4ÝKÜ˜c´°D³	ÀiÇlÁl×FfÑFfÐgjÐkoÕgpÓFqØ$Ÿ}™}°gÀhÐX\ÐdfØLÔUbôd€Fð ‡M�MÑ2Ð4KÈXÐ3VÓWÔXØÒÜ ›<ˆˆxÑØ€M÷ 
"×	!ús   £)DÄD	c              ƒ  ó¶   "  € VP                   \        8w  g   \        W4      G Rj  x€L
 ^,          e   R# \        VP                   RRR7      pRVn        V#  L05i)a  The settleable form of a ``runtime_coordination_required`` refusal, or None.

Another session writer holds the chat (a pre-authority Desktop backend's lease on a legacy Bot
Chat, a live CLI). Nothing was admitted under this id when it still has no receipt: ``_admit``
pins one before it admits and withdraws it only when nothing committed. That holds only while
this request has the lock, so ``admitted=False`` is a hint, not the verdict: the sender asks
``settle`` before it reports a no-send. Any other refusal keeps its unknown outcome.NÚsession_writerzCanother session writer holds the Bot Chat; nothing was admitted yet)ÚfieldÚdetailF)r  r   r   r	   r®  )rW   r&   rJ   râ   s   &&& r(   r¦  r¦  Q  sQ   é € ð ‡z�z”]Ô"¬\¸$Ó-D×'DÀaÕ&HÒ&TÙÜ˜SŸZ™ZÐ/?Ø$iôk€Dà€D„MØ€Kñ (Eùs   ‚$A¦A§1Ac           
   ƒ   ó¨  "  € ^ RI Hp V! RV/4      pW4 R2,          p\        WWP                  RRV,           RVP                  RVP
                  /R7      pVP                  P                  V4       V	e   \        V	4      VP                  R
&   \        T
;'       g    / V\        V4      VP
                  VP                  VRR7      pVP                  V4       RVP                  9   d   RVR&   V	e   \        V	4      VR&   \        TTT
;'       g    / P                  R4      R7      G R	j  x€L
 '       g   V
e   R	# \        R4      h V P                  V P                   P#                  VP                  4      VRV,           4      G R	j  x€L
 pTP                  RTP6                  R7       TP                  \9        T T4      4       TR,          R9   d   \;        YTTP6                  4       TR,          R9  d   \=        YTT4      G R	j  x€L
  \?        YT4      G R	j  x€L
 #  Lõ Lš  \         dž   p\%        YP
                  RT,           4      e   h TP&                  \(        9   d   T
f   \+        Y$4      G R	j  x€L 
  h \,        P.                  ! \0        4      P3                  RTTP&                  4       \5        Y$4      G R	j  x€L 
  h R	p?ii ; i LÇ Lµ5i)ru   rC  rv  rT  TrM   r<  r=  r>  NrF  r9   )r   r3   r4   r.   r   r   r6  r5  rE  r   rt  r‹   z!Bot Chat delivery %s refused (%s)r/   )r   r,   >   rù   rû   ) rM  rD  r   r˜   r—   r4   rB  rL  rà   r   ró   r�   r   r   r	   rN  r”   rO  rd   r  Ú_OWNER_STATE_REFUSALSr   r<   r=   r>   rU   r   r,   r#  rP  rR  r¢  )rV   r‚   rW   rH   r&   r   r›   r    r¡   rE  r\   rv  rD  rœ  r#   rQ  r$   rÕ   rJ   s   &&&&&&&&&&&&       r(   ry  ry  a  sy  é € åKÙ3Ð5LÐNcÐ4dÓe€LØ�E˜�-Õ€DÜ˜g¯k©kÀDØ˜C•<Ð+@À$Ç*Á*Ø)=¸u×?OÑ?Oð+QôR€Eð 
‡N�N×Ñ˜,Ô'ØÒÜ(,¨V«ˆ�‰�}Ñ%ô �&—,�,˜B¨C¼cÀ$»iÐTW×TbÑTbØ—]‘]¨G¸KôI€Fà
‡M�M�,ÔØ˜U×/Ñ/Ô/Ø!ˆˆzÑØÒÜ ›<ˆˆxÑä˜t V°V·\°\¸r×4FÑ4FÀxÓ4PÔQ×QÖQØÒÙÜÐ 4Ó5Ð5ðØ!×2Ñ2°9×3CÑ3C×3WÑ3WÐX\×XcÑXcÓ3dÐfkÐmsÐvyÕmyÓz×zˆð ‡M�M˜°7×3GÑ3G€MÔHØ
‡M�M”'˜) VÓ,Ô-ØˆhÕÐ0Ô0Ü�Y c¨7×+?Ñ+?Ô@ØˆhÕÐ4Ô4Ü˜9¨D°&Ó9×9Ð9Ü  °&Ó9×9Ð9ñ1 Rñ
 {øÜô Ü˜§N¡N°F¸SµLÓAÒMØØ�:‰:Ô.Ô.ØŠ~ä" 4Ó-×-Ñ-ð
 	ô ×ÒœhÓ'×,Ñ,Ð-PÐRUÐWZ×WaÑWaÔbÜ˜TÓ'×'Ñ'Øûðúñ" 	:Ù9ùs•   ‚BKÂA3KÄKÄ)HÄ*	KÄ4KÅA H# ÆH!ÆH# ÆA;KÈKÈKÈKÈKÈ!H# È#KÈ.AKÉ5I8É6A	KÊ?KË KËKËKËKc              ƒ  óˆ   "  € \        W4      pVP                  V4       \        W4      G Rj  x€L
  \        WV4       V#  L5i)a>  Publish the delivery's projection and answer with exactly that projection. The write is
off-loop, so the admission may settle while it runs; re-deriving the answer afterwards would
hand the sender a reply the receipt file does not hold yet (the reply watcher publishes it
once this delivery releases the mailbox lock).N)r*  rL  r   r   )rV   rW   r$   r  s   &&& r(   r¢  r¢  ‘  s?   é € ô
 ˜iÓ0€FØ
‡M�M�&ÔÜ
˜Ó
%×%Ð%Ü�Y fÔ-Ø€Mñ &ùs   ‚+A­A ®A>   r-   rù   rû   r  r9   rþ   r/   >	   r‰   rG  Ústale_epochÚsession_busyÚruntime_retiredr:  Ústale_generationr  rr  i   ))r,   r3   r4   r.   rò   )NNr  )ZÚ__doc__rÛ   Ú	functoolsr   r<   Úpathlibr   rP   Úagent.turn_authorr   Úgateway.session_contractr   r   Úgateway.configr   Úgateway.platforms.eventr   Úhermes_state_runtimer	   r
   r  r   r5   r   r   r   r=   r>   rÝ   Úgateway.session_bot_mailboxr   r   r   r   r   r   r   r   r   rI  r"   r™  r´  rš  r)   r6   r:   rA   rK   rR   r`   rQ   rS   r„   r¢   r�   r«   r·   rÈ   rŽ   rÞ   r  r	  r  rd   r#  r  r*  r.  r  r)  rR  rX  rZ  rk  r{  r€  rP  r”  r—  rž  r   r¤  r“  rª  r©  r¬  r¦  ry  r¢  ré   r7   r(   Ú<module>rÃ     s‹  ðñó
 Ý Û Ý Û å /ç :Ý #Ý 0ß IÝ 3ß BÑ BØ	×	Ò	˜8Ó	$€÷`÷ `õ `ñ (ò )ó Ð ð Ð ñ "ò #ó Ð ð "Ð ôò*$òoòiôð, Ð ò&"òR]òqòòò.ò8ò"
aò*ð &¸ô &òR"ô(ò63ò,bò#ò[ò:tòòò(#ò>ò$;.ò|2ò*
2òò2Zò<&5òR(ò"dò6ò0ò4Kô
:òGò<còò<ò$ô -:ô`	r7   