+
    jHàjv  ã                   óD   € R t ^ RIt^ RIHt ]! 0 Rm4      tR tR tR tR# )aB  A completion for a local session no viewer is watching is written into it as a note (#134889 LC-7).

Main's CLI and TUI hosted async delegations and background processes in their own process, so once
the user left nothing started a turn for them. Under the gateway the owner outlives its viewers. The
completion is admitted like any producer input. Producers still coalesce a batch into one admission
under its primary identity, the siblings' identities in its descriptor: a lookup by any of them finds
it (``completion_admission``), results already admitted are left out of a new batch, and the one
outcome, note or turn, covers the whole batch. When that admission comes up for execution with no
viewer attached (the authority's own subscriber records) the executor records it in the session's
history, where the next turn sees it, and settles the admission without a model call. Queue order, restart survival and
exactly-once are the admission contract's. With a viewer attached it runs as the turn it always was;
messaging, cron, Kanban, ``/loop`` and heartbeat wakes never reach here.
N)Úpartialc                 ó‚   €  \         P                  ! V 4      ^ ,          #   \        \        \        \
        3 d     R# i ; i)é    N)ÚjsonÚloadsÚ
ValueErrorÚ	TypeErrorÚ
IndexErrorÚKeyError)Úidentitys   &ÚE/home/ubuntu/.hermes/hermes-agent/gateway/session_completion_notes.pyÚ	_producerr      s6   € ðÜ�zŠz˜(Ó# AÕ&Ð&øÜœ	¤:¬xÐ8ô Úðús   ‚ Ÿ>½>c                ó¢   € T ;'       g    / P                  R/ 4      P                  R4      pVRJ;'       d    \        VR,          4      \        9   # )zS*row* is a local completion admission: a note when it runs with no viewer attached.ÚpayloadÚlocal_automation_v1Nr   )Úgetr   Ú_NOTED_PRODUCERS)ÚrowÚ
descriptors   & r   Únoted_completionr      sG   € à—)�)˜—‘ ¨BÓ/×3Ñ3Ð4IÓJ€JØ˜TÐ!×[Ð[¤i°
¸:Õ0FÓ&GÔK[Ñ&[Ð[ó    c              ƒ  ó–  "  € \        V4      '       g   R# ^ RIHp V P                  P	                  VP
                  4      pVe   VP                  '       d$   ^ RIHp V! V \        WPV4      4      G Rj  x€L
  R# ^ RI
Hp VR,          R,          pR\        \        VP	                  R4      ;'       g    R4      VR	,          0,          4      /pTP                  R U	u/ uF  q™V9   g   K  W—V	,          bK  	  up	4       V! WP
                  4      p
V! V \        V P                  P                   W¢R
,          VR,          R,          VP	                  RR4      V4      4      G Rj  x€L
  \#        V P$                  RR4      pVe   V! VP&                  V
4      G Rj  x€L
  RRRR. /R/ /V P(                  VR
,          &   R#  ELJu up	i  Lb L.5i)a  The claimed *row*'s response when it was written as a note instead of running, else None.
It is the FIFO head, so the note lands after every input committed before it and before every
input committed after; the viewer check and the decision share one loop step.N)Útracked_write)Úreopen_local_session)Ú_physical_targetr   r   Úcompletion_noteÚ
identitiesr   Úadmission_idÚtextÚdisplay_kindÚinternal_notificationÚ"_refresh_agent_cache_message_countÚresultÚfinal_responseÚ ÚmessagesÚusage© )Údisplay_textÚnotification_category)r   Úgateway.session_runtime_workersr   Úsessionsr   Ú
session_idÚsubscribersÚgateway.session_local_recoveryr   r   Úgateway.session_viewer_closer   ÚsortedÚsetÚupdateÚdbÚappend_completion_noteÚgetattrÚrunnerÚrouteÚpending_results)Ú	authorityÚrefr   r   Úliver   r   r   ÚmetadataÚkeyÚtargetÚrefreshs   &&&         r   Únote_if_unviewedr@   #   s«  é € ô ˜C× Ò ÙÝ=Ø×Ñ×!Ñ! #§.¡.Ó1€DØ‚|�t×'×'Ð'åGÙ˜I¤wÐ/CÐPSÓ'TÓU×UÐUÙÝ=Ø�Y•Ð 5Õ6€JØ!¤6¬#¨j¯n©n¸\Ó.J×.PÐ.PÈbÓ*QÐU_Ð`jÕUkÐTlÕ*lÓ#mÐn€HØ‡O�OÑ5^ÓtÑ5^¨cÐisÑbsÔ)�S S�/Ò)Ñ5^ÑtÔuÙ˜i¯©Ó8€Fá
˜	¤7Ø�‰×+Ñ+¨V¸Õ5HÈ#ÈiÍ.ÐY_ÕJ`Ø�‰�~Ð'>Ó?Àó$Kó L÷ Lð Lô �i×&Ñ&Ð(LÈdÓS€GØÒÙ�d—j‘j &Ó)×)Ð)Ø6>ÐAQÐSUÐWaÐceÐ@fÐhoÐqsÐ5t€I×Ñ˜c .Õ1Ñ2Ùò 	Vùò
 uñLñ
 	*ùsU   ‚AG	ÁG	Á3F=Á4>G	Â3*G	ÃG Ã*G Ã7A+G	Å"GÅ#5G	ÆGÆ%G	Ç G	ÇG	>   Ú
completionÚwatch_matchÚwatch_disabledÚasync_delegation)	Ú__doc__r   Ú	functoolsr   Ú	frozensetr   r   r   r@   r'   r   r   Ú<module>rH      s0   ðñó Ý ñ Ò`ÓaÐ òò\ôr   