+
    jHàj}0 ã                  óz  € R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	H
t
Ht ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIHtHt ^ R	IHtHtHt ^ R
IHt ^ RIHtHtH t H!t!H"t" ^ RI#H$t$ ]PJ                  ! R4      t&Rt'0 Rmt(R t)R R lt*R R lt+R R lt,R R lt-R R lt.R R lt/R R lt0 ! R R4      t1R# )!aj  Gateway slash commands that rotate, switch, fork or rewrite the session transcript:
/new, /resume, /sessions, /branch, /title, /save, /undo, /retry, /topic, /compress.
Split out of ``gateway/slash_commands.py``; bound onto ``GatewayRunner`` through
``GatewaySlashCommandsMixin``.  Origin internals are imported lazily inside the bodies to avoid
the import cycle.)ÚannotationsN)ÚOptionalÚUnion)Út)Úextract_api_content_sidecar)ÚPlatform)ÚEphemeralReply)ÚMessageEventÚMessageType)ÚSessionSourceÚbuild_session_keyÚis_shared_multi_user_session)ÚTranscriptReadError)ÚBRANCH_THREAD_PLATFORMSÚbranch_dest_sourceÚbranch_thread_parentÚformat_thread_refÚparse_branch_args)Úhistory_unreadablezgateway.rung      >@c               ó    € V ^8„  d   QhRRRR/# )é   ÚnameÚstrÚreturn© )Úformats   "ÚC/home/ubuntu/.hermes/hermes-agent/gateway/slash_commands_session.pyÚ__annotate__r   *   s   € ÷ -ñ -�cð -˜cñ -ó    c                ó@   € \        \        WR4      ;'       g    R4      # )uW   ``str(getattr(obj, name) or "")`` â€” normalized identity field for origin comparisons.Ú )r   Úgetattr)Úobjr   s   &&r   Ú_sattrr#   *   s   € äŒw�s "Ó%×+Ð+¨Ó,Ð,r   c               ó    € V ^8„  d   QhRRRR/# )r   ÚsummaryÚdictr   ú	list[str]r   )r   s   "r   r   r   /   s   € ÷ ñ ¨Tð Èyñ r   c                óZ  € RV R,           2.pV'       d   VP                  \        RVR7      4       VP                  V R,          4       V R,          '       d   VP                  V R,          4       \        VRR4      pV'       d   ^ R	IHp V! VR
R7      p\        VRR4      p\        VRR4      '       d2   TP                  \        RT;'       g    \        R4      R7      4       V# V'       d=   \        VRR4      ;'       g    \        R4      pVP                  \        RWgR7      4       V# )aE  Manual /compress confirmation lines, surfacing summariser/aux-model failures.
``_last_compress_aborted`` = no usable summary, messages unchanged.  Provider exception text is
force-redacted at this UI boundary even when global redaction is off; an aux model recovered
via main is an info note so the user can fix their config.õ   ðŸ—œï¸� Úheadlinezgateway.compress.focus_line)ÚtopicÚ
token_lineÚnoteÚ_last_summary_errorN)Úredact_sensitive_textT)ÚforceÚ_last_aux_model_failure_modelÚ_last_compress_abortedFzgateway.compress.abortedzgateway.shared.unknown_error©ÚerrorÚ_last_aux_model_failure_errorzgateway.compress.aux_failed)Úmodelr4   )Úappendr   r!   Úagent.redactr/   )r%   Ú
compressorÚfocus_topicÚlinesÚsummary_errr/   Úaux_fail_modelÚaux_errs   &&&     r   Ú_manual_compression_reply_linesr?   /   sÿ   € ð
 ˜ 
Õ+Ð,Ð-Ð.€EßØ�‰”QÐ4¸KÔHÔIØ	‡L�L�˜Õ&Ô'Øˆv‡„Ø�‰�W˜V•_Ô%Ü˜*Ð&;¸TÓB€KßÝ6Ù+¨K¸tÔDˆÜ˜ZÐ)HÈ$ÓO€NÜˆzÐ3°U×;Ò;Ø�‰”QÐ1¸+×:jÐ:jÌÐKiÓIjÔlÔmð €L÷ 
Ü˜*Ð&EÀtÓL×qÐqÔPQÐRpÓPqˆØ�‰”QÐ4¸NÔZÔ[Ø€Lr   c               ó$   € V ^8„  d   QhRRRRRR/# )r   ÚpartialÚboolÚagg_noter   r   r   )r   s   "r   r   r   G   s#   € ÷ ñ ¨dð ÐVYð Ð^añ r   c           	     ó   € ^ RI Hp ^ RIHp V  Uu. uFX  pVP	                  R4      R9   g   K  VP	                  R4      '       g   K4  RVP	                  R4      RVP	                  R4      /NKZ  	  ppV! W�W#V! V4      4      p	V	R,           U
u. uF  p
RV
 2NK
  	  pp
V'       d   VP                  V4       RP                  V4      # u upi u up
i )	uQ   ``/compress --preview``: report what WOULD be compressed â€” no agent, no writes.)Úestimate_request_tokens_rough)Úsummarize_compress_previewÚroleÚcontentr;   r)   Ú
>   ÚuserÚ	assistant)Úagent.model_metadatarE   Úhermes_cli.partial_compressrF   Úgetr7   Újoin)ÚhistoryrA   Ú	keep_lastr:   rC   rE   rF   ÚmÚpv_msgsÚreportÚliner;   s   &&&&&       r   Ú_compress_preview_replyrV   G   sÄ   € åBÝFáMTó OÉWÈØ—%‘%˜“-Ð#8Ñ8ô DØ=>¿U¹UÀ9×=Mô D�˜Ÿ™˜f› y°!·%±%¸	Ó2BÓCÉW€Gð Oá'¨¸)Ù(EÀgÓ(NóP€Fà+1°'®?Ó;©? 4ˆx˜�vÓ©?€EÐ;ßØ�‰�XÔØ�9‰9�UÓÐùòOùò <s   ‘C®CÁ(CÂCc               ó   € V ^8„  d   QhRR/# ©r   r   ÚNoner   )r   s   "r   r   r   V   s   € ÷ !ñ !¨$ñ !r   c                 ó4  € \         P                  ! \        4      ;_uu_ 4        ^ RIHp  V ! 4        RRR4       \         P                  ! \        4      ;_uu_ 4        ^ RIHp V! 4        RRR4       R#   + '       g   i     LJ; i  + '       g   i     R# ; i)zXDrop env-passthrough and credential-file state at a conversation boundary (best-effort).)Úclear_env_passthroughN)Úclear_credential_files)Ú
contextlibÚsuppressÚ	ExceptionÚtools.env_passthroughr[   Útools.credential_filesr\   )r[   r\   s     r   Ú _reset_process_scoped_tool_staterb   V   sZ   € ä	×	Ò	œY×	'Õ	'Ý?ÙÔ÷ 
(ô 
×	Ò	œY×	'Õ	'ÝAÙÔ ÷ 
(Ñ	'÷ 
(×	'ú÷ 
(×	'Ð	'ús   £A3ÁBÁ3B	ÂB	c               ó    € V ^8„  d   QhRRRR/# )r   Úmsgr&   r   r   )r   s   "r   r   r   `   s   € ÷ ñ �Tð ˜dñ r   c                óø   € \          Uu/ uF  qV P                  V4      bK  	  ppV P                  RR4      VR&   V P                  R4      ;'       g    V P                  R4      VR&   \        V 4      VR&   V# u upi )z©/branch child row; keeps the api_content sidecar so the branch's first turn replays the
parent's exact wire bytes (warm provider prompt cache) instead of a cold prefill.rG   rJ   Ú	tool_namer   Úapi_content)Ú_BRANCH_COPIED_FIELDSrN   r   )rd   ÚkÚrows   &  r   Ú_branch_rowrk   `   st   € õ #8Ó
8Ñ"7˜Qˆc�g‰g�a‹jŠ=Ñ"7€CÐ
8Ø—'‘'˜& &Ó)€Cˆ�KØ—w‘w˜{Ó+×>Ð>¨s¯w©w°v«€CˆÑÜ4°SÓ9€CˆÑØ€Jùò	 9s   ‰A7c               ó    € V ^8„  d   QhRRRR/# )r   Úpartsr'   r   r   r   )r   s   "r   r   r   j   s   € ÷ ñ ˜ið ¨Cñ r   c                óÆ   € RP                  R V  4       4      P                  4       p\        V4      ^8¼  d+   V^ ,          VR,          3R9   d   V^R P                  4       pV# )zwJoin the non-flag /resume tokens; strip literal ``<...>``/``[...]``/quotes typed from the
usage hint (mirrors the CLI).Ú c              3  ó6   "  € T F  qR9  g   K  Vx € K  	  R# 5i)ú--allN>   rq   ú--cross-roomr   )Ú.0Úps   & r   Ú	<genexpr>Ú%_strip_resume_name.<locals>.<genexpr>m   s   é € ÐK™u˜!Ð1JÑ(J—A’A›uùs   ‚�
éÿÿÿÿ>   ©Ú"ry   ©Ú'r{   ©Ú<Ú>©Ú[Ú])rO   ÚstripÚlen)rm   r   s   & r   Ú_strip_resume_namer„   j   sZ   € ð �8‰8ÑK™uÓKÓK×QÑQÓS€DÜ
ˆ4ƒy�A„~˜4 �7 D¨¥HÐ-Ð1aÔaØ�A�bˆz×ÑÓ!ˆØ€Kr   c               ó   € V ^8„  d   QhRR/# )r   r   r   r   )r   s   "r   r   r   s   s   € ÷ [ñ [°sñ [r   c              ƒ  óL  "  € ^ RI Hp ^ RIHpHp \
        P                  ! W@P                  VR7      G Rj  x€L
 pV Uu. uF  qfR,          R8X  g   K  VNK  	  ppV'       g   \        R4      # V! V P                  V4      p^ p	V F5  p V P                  W†R,          VR	,          4      G Rj  x€L
  T	^,          p	K7  	  V	'       d   \        RV	R7      # \        R4      #  L§u upi  L8  T d4   p
\        P                  R
TR,          T
P                  4        Rp
?
K—  Rp
?
ii ; i5i)a1  Messaging ``/discard`` (#134889 GW-10): acknowledge every ``unknown`` (lost-in-restart) turn
of this chat's FIFO through the owner's fenced ``resolve_unknown``, the path Desktop's Discard,
the TUI queue and ``hermes sessions discard`` use. Never replays the input; the saved
followers run once it commits.)Ú
SessionRef)ÚRuntimeStoreErrorÚlist_session_admissions©Ú
session_idNÚstatusÚunknownúgateway.discard.nothingÚadmission_idÚ
generationz/discard of %s refused: %szgateway.discard.done©Úcount)Úgateway.session_contractr‡   Úhermes_state_runtimerˆ   r‰   ÚasyncioÚ	to_threadÚdbr   Ú
profile_idÚresolve_unknown_as_ownerÚloggerÚwarningÚreason)Ú	authorityr‹   r‡   rˆ   r‰   Úrowsrj   ÚlostÚrefÚdoneÚexcs   &&         r   Údiscard_lost_turnsr£   s   s   é € õ
 4ßOÜ×"Ò"Ð#:¿L¹LÐU_Ô`×`€DÙÓ>™4�C x¥=°IÑ#=�CˆC™4€DÐ>ßÜÐ*Ó+Ð+Ù
�Y×)Ñ)¨:Ó
6€CØ€DÛˆð	Ø×4Ñ4°S¸nÕ:MÈsÐS_ÕO`Óa×aÐað 	��	Šñ ÷ 59Œ1Ð#¨4Ô0ÐZ¼aÐ@YÓ>ZÐZñ aùÚ>ñ bøØ ô 	Ü�N‰NÐ7¸¸^Õ9LÈcÏjÉjÔYÝûð	üsh   ‚4D$¶C·D$¿C ÁC Á/D$Â	#C'Â,C%Â-C'Â1D$ÃD$Ã D$Ã%C'Ã'D!Ã.(DÄD$ÄD!Ä!D$c                  óì  € ] tR t^ŠtRtR R ltR R ltR R ltR R	 ltR
 R lt	R R lt
]R R l4       tR R ltR R ltR R ltR R ltRNR R lltR R ltR R ltR R ltR  R! ltR" R# ltR$ R% ltROR& R' lltR( R) ltR* R+ ltR, R- ltR. R/ ltR0 R1 ltR2 R3 ltR4 R5 ltRPR6 R7 llt R8 R9 lt!R: R; lt"R< R= lt#R> R? lt$R@ RA lt%RB RC lt&RD RE lt'RF RG lt(RH RI lt)RJ RK lt*RLt+RM# )QÚGatewaySessionCommandsMixinzwSession-transcript slash commands (/new, /resume, /sessions, /branch, /title, /save, /undo, /retry, /topic, /compress).c               ó    € V ^8„  d   QhRRRR/# )r   Úsession_keyr   r   rY   r   )r   s   "r   r   Ú(GatewaySessionCommandsMixin.__annotate__�   s   € ÷ *ñ *¸cð *Àdñ *r   c              ƒ  ól  "  € V P                  V4      pVf   R#  \        P                  ! V P                  V P                  V4      \
        R7      G Rj  x€L
  R#  L  \         d     \        P                  RT\
        4        R# \         d"   p\        P                  RY4        Rp?R# Rp?ii ; i5i)u4  Close the old agent's tool resources (sandboxes, browsers, subprocesses) before eviction.
Blocking work on the event loop (confirm-button click) â†’ offloaded with a bounded timeout.
wait_for cancels the await, not the worker thread: a wedged teardown keeps running (or
leaks); the reset proceeds either way.N)Útimeoutz–Agent resource cleanup for session %s exceeded %ss during /new reset; proceeding with reset (the worker thread is left to finish on its own). (#35994)zKAgent resource cleanup for session %s failed during /new reset: %s (#35994))
Ú_cached_agent_forr•   Úwait_forÚ_run_housekeeping_in_executorÚ_cleanup_agent_resourcesÚ_RESET_CLEANUP_TIMEOUT_SÚTimeoutErrorrš   r›   r_   )Úselfr§   Ú
_old_agentÚcleanup_excs   &&  r   Ú_cleanup_old_agent_for_resetÚ8GatewaySessionCommandsMixin._cleanup_old_agent_for_reset�   s¡   é € ð
 ×+Ñ+¨KÓ8ˆ
ØÒÙð	*Ü×"Ò"Ø×2Ñ2°4×3PÑ3PÐR\Ó]Ü0ô2÷ 2ô 2øô ô 	7Ü�N‰NðSàÔ5÷7ô ô 	*Ü�N‰NØ]Ø÷*ò *ûð	*üsR   ‚B4›9A ÁAÁA ÁB4ÁA Á&B1ÂB4ÂB1ÂB1ÂB,Â&B4Â,B1Â1B4c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úsourcer   r§   r   r   rY   r   )r   s   "r   r   r¨   ¥   s(   € ÷ Cñ C°mð CÐRUð CØ48ñCr   c           
   ƒ  ó4  "  € VP                   '       d   VP                   P                  MRp\        P                  ! \        4      ;_uu_ 4        V P                  W5RW4R7      G Rj  x€L
 pV P                  WaVR7      G Rj  x€L
  RRR4       RVRVP                  RV/pV P                  P                  R	\        V4      4      G Rj  x€L
  V P                  P                  R
\        V4      4      G Rj  x€L
  R#  L• L|  + '       g   i     L‚; i LJ L5i)u‰   Session-boundary hooks: plugin finalize (off-loop + bounded â€” trace exports can block
arbitrarily), then session:end and session:reset.r    Únew_session)r‹   Úplatformrœ   Úold_session_idÚnew_session_idN©r·   r§   rº   Úuser_idr§   zsession:endzsession:reset)rº   Úvaluer]   r^   r_   Ú_finalize_session_off_loopÚ_deliver_session_end_messagesr¾   ÚhooksÚemitr&   )r±   r·   r§   Úold_sidÚnew_sidÚplatform_valueÚmessagesÚhook_payloads   &&&&&   r   Ú_fire_session_reset_hooksÚ5GatewaySessionCommandsMixin._fire_session_reset_hooks¥   sç   é € ð 39·/·/°/˜Ÿ™×.Ò.ÀrˆÜ× Ò ¤×+Õ+Ø!×<Ñ<Ø"ÀMØ&ð =ó @÷ @ˆHð ×4Ñ4°XÐZeÐ4Óf×fÐf÷	 ,ð
 # N°I¸v¿~¹~È}Ð^iÐjˆØ�j‰j�o‰o˜m¬T°,Ó-?Ó@×@Ð@Ø�j‰j�o‰o˜o¬t°LÓ/AÓB×BÒBñ@ñ g÷	 ,×+úñ 	AÙBùsa   ‚ADÁDÁ'C=Á(DÂC?ÂDÂADÃ	DÃ
,DÃ6DÃ7DÃ=DÃ?DÄD	Ä	DÄDc               ó    € V ^8„  d   QhRRRR/# ©r   Úeventr	   r   r   r   )r   s   "r   r   r¨   ³   s   € ÷ 8ñ 8°<ð 8ÀCñ 8r   c              ƒ  óÄ  "  € ^ RI Hp V P                  VP                  4      '       g   \	        R4      # V! V 4      pV P                  VP                  4      pV'       d+   VP                  V P                  P                  V4      4      MRpV'       g   \	        R4      # WSP                  9  d   VP                  VP                  WT4       \        W54      G Rj  x€L
 #  L5i)zV``/discard``: drop this chat's turn lost in a gateway restart so its queue runs again.©Úactive_authorityrŽ   N)Úgateway.session_authoritiesrÐ   Ú_is_user_authorized_for_sourcer·   r   Ú_session_key_for_sourceÚlogical_ownerÚsession_storeÚpeek_session_idÚsessionsÚ_publish_router£   )r±   rÍ   rÐ   r�   r§   Úsids   &&    r   Ú_handle_discard_commandÚ3GatewaySessionCommandsMixin._handle_discard_command³   s¯   é € å@Ø×2Ñ2°5·<±<×@Ò@ÜÐ.Ó/Ð/Ù$ TÓ*ˆ	Ø×2Ñ2°5·<±<Ó@ˆßZcˆi×%Ñ% d×&8Ñ&8×&HÑ&HÈÓ&UÔVÐimˆßÜÐ.Ó/Ð/Ø×(Ñ(Ô(ð ×$Ñ$ U§\¡\°3ÔDÜ'¨	Ó7×7Ð7Ñ7ùs   ‚AC Á 3C ÂAC ÃCÃC c               ó    € V ^8„  d   QhRRRR/# )r   rÍ   r	   r   zstr | EphemeralReplyr   )r   s   "r   r   r¨   Ä   s   € ÷ H4ñ H4°ð H4ÐBVñ H4r   c              ƒ  óJ  "  € VP                   pV P                  V4      pV P                  V4      G Rj  x€L
  V P                  VRR7       V P	                  V4       V P
                  P                  P                  V4      pV P                  V4      G Rj  x€L
  V P                  V4       V P                  VRR7       \        P                  ! \        4      ;_uu_ 4        ^ RIHp T! TR\!        \#        VRR4      ;'       g    R4      R7       RRR4       \%        4        V P&                  P)                  V4      G Rj  x€L
 pV'       d   VP*                  MRp^ RIHp V! WV4      G Rj  x€L
  T P1                  Y#TV'       d   VP*                  MR4      G Rj  x€L
   \2        P4                  ! V P6                  V4      G Rj  x€L
 p	V'       d   \9        R	4      p
M0V P&                  P;                  VR
R7      G Rj  x€L
 p\9        R4      p
\2        P4                  ! V P<                  V4      G Rj  x€L
 ;'       g    T
pVP?                  4       PA                  4       pV'       d?   V PB                  '       d-   V'       d%   V PE                  W¶P*                  V4      G Rj  x€L
 p\2        P4                  ! V PF                  V4      G Rj  x€L
 '       d/   Ve+    \2        P4                  ! V PH                  W&4      G Rj  x€L
  V'       d   VP*                  MRp ^ RI'H(p T! RTRVPR                  '       d   VPR                  PT                  MRW}R7        ^ RI+H,p \9        RV! 4       R7      pV	'       d   V RV	 2MTp\[        V V 24      #  EL[ ELü  + '       g   i     EL�; i ELh EL> EL ELë  \         d    Rp	 ELùi ; i ELÉ EL˜ EL- EL LÕ  \         d    \J        PM                  RR
R7        L÷i ; i  \         d     L¶i ; i  \         d    Rp L°i ; i5i)zHandle /new or /reset command.NÚsession_reset©rœ   )Úinterrupt_for_sessionr‹   r    )r§   rœ   Úparent_session_id)Úmove_route_wakeszgateway.reset.header_defaultT)Ú	force_newzgateway.reset.header_newz*Failed to rebind Telegram topic after /new©Úexc_info)Úinvoke_hookÚon_session_resetr¹   )r‹   rœ   rº   r»   r¼   )Úget_random_tipzgateway.reset.tip)Útipú

).r·   rÓ   Ú_hm_stop_owner_turnÚ"_invalidate_session_run_generationÚ_release_running_agent_staterÕ   Ú_entriesrN   r´   Ú_evict_cached_agentÚ_clear_conversation_scoper]   r^   r_   Útools.async_delegationrà   r   r!   rb   Úasync_session_storeÚreset_sessionr‹   Úgateway.session_automationrâ   rÉ   r•   r–   Ú_reset_notice_session_infor   Úget_or_create_sessionÚ_telegram_topic_new_headerÚget_command_argsr‚   Ú_session_dbÚ_reset_titled_headerÚ_is_telegram_topic_laneÚ_record_telegram_topic_bindingrš   ÚdebugÚhermes_cli.lifecycleræ   rº   r¿   Úhermes_cli.tipsrè   r   )r±   rÍ   r·   r§   Ú	old_entryrà   Ú	new_entryÚ_old_sidrâ   Úsession_infoÚdefault_headerÚheaderÚ
_title_argÚ_new_sidÚ_invoke_hookrè   Ú	_tip_lineÚbodys   &&                r   Ú_handle_reset_commandÚ1GatewaySessionCommandsMixin._handle_reset_commandÄ   sŽ  é € à—‘ˆØ×2Ñ2°6Ó:ˆØ×&Ñ& {Ó3×3Ð3Ø×/Ñ/°ÀOÐ/ÔTð 	×)Ñ)¨+Ô6ð ×&Ñ&×/Ñ/×3Ñ3°KÓ@ˆ	Ø×/Ñ/°Ó<×<Ð<Ø× Ñ  Ô-ð 	×&Ñ& {¸?Ð&ÔKô × Ò ¤×+Õ+ÝDÙ!¨kÀ/Ü47¼À	È<ÐY[Ó8\×8bÐ8bÐ`bÓ4cõe÷ ,ô 	)Ô*à×2Ñ2×@Ñ@ÀÓM×Mˆ	ß+4�9×'Ò'¸$ˆÝ?Ù˜t°(Ó;×;Ð;Ø×,Ñ,¨VÀ(ßEN¨Y×-AÒ-AÐTXóZ÷ 	Zð 	Zð	Ü!(×!2Ò!2°4×3RÑ3RÐTZÓ![×[ˆL÷ ÜÐ=Ó>‰Nà"×6Ñ6×LÑLÈVÐ_cÐLÓd×dˆIÜÐ9Ó:ˆNÜ×(Ò(¨×)HÑ)HÈ&ÓQ×Q×cÐcÐUcˆØ×+Ñ+Ó-×3Ñ3Ó5ˆ
ß˜$×*×*Ð*¯yØ×4Ñ4°V×=QÑ=QÐS]Ó^×^ˆFô ×"Ò" 4×#?Ñ#?ÀÓH×HÖHÈYÒMbðZÜ×'Ò'¨×(KÑ(KÈVÓ_×_Ð_÷ ,5�9×'Ò'¸$ˆð	ÝHÙÐ+¸ÈØ;A¿?¿?¸? &§/¡/×"7Ò"7ÐPRØ(0õKð
	Ý6ÜÐ-±>Ó3CÔDˆI÷ 1=�&�˜˜l˜^Ñ,À&ˆÜ   y kÐ2Ó3Ð3òI 	4ò 	=÷ ,×+Ð+úò Nò 	<ò	Zò
 \øÜô 	Ø‹Lð	úò
 eâQò _ò Iá_øÜô ZÜ—‘ÐIÐTX�ÖYðZûô ô 	Ùð	ûô
 ô 	ØŠIð	üs—  ‚2P#´NµA!P#ÂNÂA
P#Ã!0NÄ0P#ÅN)ÅP#Å P#Å.N,Å/.P#ÆN/ÆP#Æ#$N5 ÇN2ÇN5 ÇP#Ç,P#È O	È3P#È4OÈ5
P#É (P#É)P#É;P#ÊP#Ê"OÊ#(P#ËOË	P#ËP#Ë$O Ë?OÌ O ÌP#ÌP#ÌO? Ì8O? ÍP Í/P#Í7P#ÎP#ÎN&	Î 
P#Î,P#Î/P#Î2N5 Î5OÏP#ÏOÏP#ÏP#ÏP#ÏP#ÏO Ï"O<Ï9P#Ï;O<Ï<P#Ï?PÐ
P#ÐPÐP#ÐP ÐP#ÐP Ð P#c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r  r   r‹   Ú	title_argr   r   )r   s   "r   r   r¨     s*   € ÷ ñ °ð À#ð ÐRUð ÐZ]ñ r   c              ƒ  óê  "  € ^ RI Hp Rp VP                  V4      pV'       d:    V P                  P                  W&4      G Rj  x€L
  \	        RVR7      pW,           # V'       g   \	        R	4      pW,           #   \         d#   pRp\	        R\        T4      R7      p Rp?L„Rp?ii ; i Ld  \         d(   p\	        R\        T4      R7      p Rp?Y,           # Rp?i\         d     Y,           # i ; i5i)
zR``/new <title>``: titled header on success, else the header plus a rejection note.©Ú	SessionDBr    Nzgateway.reset.title_rejectedr3   zgateway.reset.header_titled©Útitlez"gateway.reset.title_error_untitledz"gateway.reset.title_empty_untitled)	Úhermes_stater  Úsanitize_titleÚ
ValueErrorr   r   rù   Úset_session_titler_   )r±   r  r‹   r  r  r-   Ú	sanitizedÚes   &&&&    r   rú   Ú0GatewaySessionCommandsMixin._reset_titled_header  sè   é € å*Øˆð	CØ!×0Ñ0°Ó;ˆI÷ ðØ×&Ñ&×8Ñ8¸ÓO×OÐOÜÐ8À	ÔJ�ð �}Ð÷ ÜÐ9Ó:ˆDØ�}Ðøô ô 	CØˆIÜÐ3¼3¸q»6ÔB�Dûð	Cúñ
 Pøäô MÜÐ=ÄSÈÃVÔL”ð
 �}Ðûô	 ô Øð �}Ðð	üs€   ‚	C3ŒA9 �C3¦B+ ÁB)ÁB+ ÁC3Á&C3Á9B&ÂB!ÂC3Â!B&Â&C3Â)B+ Â+C0Â6CÃC3ÃC0Ã%C0Ã&	C3Ã/C0Ã0C3c               ó    € V ^8„  d   QhRRRR/# )r   r‹   r   r   úOptional[SessionSource]r   )r   s   "r   r   r¨   %  s   € ÷ 	Mñ 	M¸ð 	MÐAXñ 	Mr   c                ó<  a€ \        \        V P                  4      RR4      p\        V4      '       d'   V! V P                  S4      pVe   \        VRR4      # R# \        V P                  R/ 4      ;'       g    / p\	        V3R lVP                  4        4       R4      # )z2Best-effort origin lookup for gateway session IDs.Úlookup_by_session_idNÚoriginrî   c              3  óf   <"  € T F&  p\        VR R4      S8X  g   K  \        VRR4      x € K(  	  R# 5i)r‹   Nr  )r!   )rs   r  r‹   s   & €r   ru   ÚMGatewaySessionCommandsMixin._gateway_session_origin_for_id.<locals>.<genexpr>-  s8   øé € ð FÑ9I°AÜ  <°Ó6¸*ÑDô 0”W˜Q ¨$×/Ð/Ó9Iùs   ƒ1œ1)r!   ÚtyperÕ   ÚcallableÚnextÚvalues)r±   r‹   ÚlookupÚentryÚentriess   &f   r   Ú_gateway_session_origin_for_idÚ:GatewaySessionCommandsMixin._gateway_session_origin_for_id%  s–   ø€ äœ˜d×0Ñ0Ó1Ð3IÈ4ÓPˆÜ�F×ÒÙ˜4×-Ñ-¨zÓ:ˆEØ5:Ò5F”7˜5 (¨DÓ1ÐPÈDÐPä˜$×,Ñ,¨j¸"Ó=×CÐCÀˆÜô F¸¿¹Ô9Ió FØGKóMð 	Mr   c               ó$   € V ^8„  d   QhRRRRRR/# ©r   Úcurrentr   r  r  r   rB   r   )r   s   "r   r   r¨   1  s(   € ÷ Qñ Q =ð QÐ:Qð QÐVZñ Qr   c                	ó"  € VR J;'       d…    VP                   \        P                  8H  ;'       d`    V P                   \        P                  8H  ;'       d;    VP                  V P                  8H  ;'       d    \	        V R4      \	        VR4      8H  # )NÚ	thread_id)rº   r   ÚMATRIXÚchat_idr#   )r-  r  s   &&r   Ú_same_matrix_roomÚ-GatewaySessionCommandsMixin._same_matrix_room0  s‰   € ð ˜dÐ"÷ Pð P v§¡¼(¿/¹/Ñ'I÷ Pð PØ×$Ñ$¬¯©Ñ7÷Pð PØ<B¿N¹NÈgÏoÉoÑ<]÷Pð Pä˜7 KÓ0´F¸6À;Ó4OÑOð	Qr   c               ó$   € V ^8„  d   QhRRRRRR/# r,  r   )r   s   "r   r   r¨   8  s(   € ÷ @ñ @¨ð @Ð@Wð @Ð\`ñ @r   c                ó  € Ve   Vf   R# VP                   VP                   8w  g   VP                  VP                  8w  d   R# \        VR4      \        VR4      8w  d   R# \        VR4      P                  4       \        9   d’   \        VR4      '       d   R# \        VP                  ;'       g    VP                  ;'       g    R4      p\        VP                  ;'       g    VP                  ;'       g    R4      p\        V4      ;'       d    W48H  # V P                  V4      '       d   R# VP                  ;'       g    VP                  pVP                  ;'       g    VP                  p\        T;'       d    T4      ;'       d    W48H  # )zéPlatform-agnostic counterpart to ``_same_matrix_room``.  Per-participant sessions must be
participant-scoped here too, else a co-member could resume another member's live session
(IDOR); only an explicitly shared group/thread shares.Fr/  Ú	chat_typer1  Tr    )
rº   r1  r#   ÚlowerÚ_DM_CHAT_TYPESr   Úuser_id_altr¾   rB   Ú_is_shared_session_source)r±   r-  r  Úcur_pidÚorg_pids   &&&  r   Ú_same_origin_chatÚ-GatewaySessionCommandsMixin._same_origin_chat8  s6  € ð Š>˜Wš_ÙØ�?‰?˜g×.Ñ.Ô.°&·.±.ÀGÇOÁOÔ2SÙä�'˜;Ó'¬6°&¸+Ó+FÔFÙÜ�'˜;Ó'×-Ñ-Ó/´>ÔAô �g˜y×)Ò)ÙÜ˜'×-Ñ-×FÐF°·±×FÐFÀBÓGˆGÜ˜&×,Ñ,×DÐD°·±×DÐDÀ"ÓEˆGÜ˜“=×7Ð7 WÑ%7Ð7ð ×)Ñ)¨'×2Ò2ÙØ×%Ñ%×8Ð8¨¯©ˆØ×$Ñ$×6Ð6¨¯©ˆÜ�G×'Ð' Ó(×?Ð?¨WÑ-?Ð?r   c               ó    € V ^8„  d   QhRRRR/# ©r   r·   r   r   rB   r   )r   s   "r   r   r¨   T  s   € ÷ ^ñ ^°ð ^À$ñ ^r   c           	     ór   € \        V\        V P                  RR4      \        V P                  RR4      R7      # )z§Whether *source*'s session key is shared by every participant (not per-user); mirrors
build_session_key's isolation rules so the guards stay in lock-step with the key.Úgroup_sessions_per_userTÚthread_sessions_per_userF)rB  rC  )r   r!   Úconfig)r±   r·   s   &&r   r:  Ú5GatewaySessionCommandsMixin._is_shared_session_sourceT  s9   € ô ,Ø¬G°D·K±KÐAZÐ\`Ó,aÜ%,¨T¯[©[Ð:TÐV[Ó%\ô^ð 	^r   c               ó    € V ^8„  d   QhRRRR/# r@  r   )r   s   "r   r   r¨   [  s   € ÷ 
ñ 
¨mð 
Àñ 
r   c                óÎ   €  ^ RI Hp V! W4      p\        VRR4      p\        VP                  ;'       d    T;'       d    VP                  V4      4      #   \         d     R# i ; i)u
  Whether *source* is an EXPLICITLY-configured admin (cross-origin /resume, /sessions).
Stricter than ``SlashAccessPolicy.is_admin()``, which is True for every caller when slash
gating is DISABLED â€” the default config would make everyone cross-origin-capable (IDOR).)Úpolicy_for_runner_sourcer¾   NF)Úgateway.slash_accessrH  r!   rB   ÚenabledÚis_adminr_   )r±   r·   rH  ÚpolicyÚuids   &&   r   Ú_resume_caller_is_adminÚ3GatewaySessionCommandsMixin._resume_caller_is_admin[  s\   € ð	ÝEÙ-¨dÓ;ˆFÜ˜& )¨TÓ2ˆCÜ˜Ÿ™×GÐG¨3×GÐG°6·?±?À3Ó3GÓHÐHøÜô 	Úð	ús   ‚<A ¿A ÁA$Á#A$c               ó$   € V ^8„  d   QhRRRRRR/# )r   r·   r   rj   r&   r   rB   r   )r   s   "r   r   r¨   g  s!   € ÷  7ñ  7°-ð  7Àdð  7Ètñ  7r   c                óš  € VP                   '       d   VP                   P                  MRpVP                  R4      p\        VR4      pV'       g   R# \	        VP                  R4      ;'       g    R4      pV'       d3   V'       d+   \	        V4      \	        V4      8X  d   V\        VR4      8X  g   R# \	        VP                  R4      ;'       g    R4      p\	        VP                  R4      ;'       g    R4      p\        VR4      p	\        \        VR4      4      p
\        VR	4      P                  4       \        9   d>   V
'       d   V'       d	   V	'       g   R# \        V4      ;'       d    Wu8H  ;'       d    W‰8H  # V'       d   V	'       d   W‰8X  g   R# V P                  V4      '       d   R
# V
'       d   R# \        V4      ;'       d    Wu8H  # )aO  Whether a persisted (inactive) session *row* provably belongs to *source*'s session key.
Rows once stored only source + user_id, so the persisted chat/thread origin is compared too
and legacy NULL rows fail closed.  The table has no user_id_alt column, so an alt-keyed
(Signal/Feishu) caller is never proven by user_id alone (CWE-639).Nr·   r¾   Fr/  r    r1  r9  r6  T)	rº   r¿   rN   r#   r   rB   r7  r8  r:  )r±   r·   rj   Ú
caller_srcÚrow_srcÚ
caller_uidÚ
row_threadÚrow_uidÚrow_chatÚcaller_chatÚcaller_keys_on_alts   &&&        r   Ú_persisted_row_proves_ownerÚ7GatewaySessionCommandsMixin._persisted_row_proves_ownerg  sR  € ð
 /5¯o¯o¨o�V—_‘_×*Ò*À4ˆ
Ø—'‘'˜(Ó#ˆÜ˜F IÓ.ˆ
ßÙÜ˜Ÿ™ Ó-×3Ð3°Ó4ˆ
ßŸJ¬3¨w«<¼3¸z»?Ô+JØ¤&¨°Ó"=Ô=ÙÜ�c—g‘g˜iÓ(×.Ð.¨BÓ/ˆÜ�s—w‘w˜yÓ)×/Ð/¨RÓ0ˆÜ˜V YÓ/ˆÜ!¤&¨°Ó"?Ó@ÐÜ�&˜+Ó&×,Ñ,Ó.´.Ô@ç!¯8¿ÙÜ˜“=×VÐV WÑ%:×VÐV¸xÑ?VÐVçŸ[¨XÔ-DÙð ×)Ñ)¨&×1Ò1ÙßÙÜ�G‹}×6Ð6 Ñ!6Ð6r   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r·   r   Ú	target_idr   Úallow_overriderB   r   r   )r   s   "r   r   r¨   ‰  s*   € ÷ =ñ =°=ð =ÈSð =Ø59ð=ØFJñ=r   c              ƒ  óŠ  "  € V'       d   V P                  V4      '       d   R#  V P                  V4      p\        V\        4      '       d   V P                  W4      #  V P                  P                  V4      G Rj  x€L
 ;'       g    / pT P                  Y4      #   \         d    Rp Lui ; i L2  \         d     R# i ; i5i)zØWhether *source* may resume session *target_id* (IDOR guard for every adapter).  The live
origin decides when the target is active; otherwise the DB row must PROVE ownership or fail
closed.  Admin ``--all`` bypasses.TNF)	rN  r)  r_   Ú
isinstancer   r=  rù   Úget_sessionrZ  )r±   r·   r]  r^  r  rj   s   &&&&  r   Ú_resume_target_allowedÚ2GatewaySessionCommandsMixin._resume_target_allowed‰  s¸   é € ÷
 ˜d×:Ñ:¸6×BÒBÙð	Ø×8Ñ8¸ÓCˆFô �fœm×,Ò,Ø×)Ñ)¨&Ó9Ð9ð	Ø×(Ñ(×4Ñ4°YÓ?×?×EÐEÀ2ˆCð ×/Ñ/°Ó<Ð<øô ô 	ØŠFð	úñ
 @øÜô 	Úð	üsh   ‚C¢C¥B ¶'CÁB1 Á<B/Á=
B1 ÂB1 ÂCÂB,Â)CÂ+B,Â,CÂ/B1 Â1C Â<CÂ?C Ã Cc               ó(   € V ^8„  d   QhRRRRRRRR/# )r   r·   r   rj   r&   Ú	allow_allrB   r   r   )r   s   "r   r   r¨   �  s0   € ÷ Tñ T°ð TÀDð TÐUYð TÐ^bñ Tr   c              ƒ  óL  "  € V'       d   V P                  V4      '       d   R# \        VP                  R4      ;'       g    R4      pVP                  \        P
                  8X  d!   V P                  WP                  V4      4      # V P                  WRR7      G Rj  x€L
 #  L5i)z¯Whether a listing *row* belongs to the caller's origin (blocks cross-origin enumeration of
ids/previews); Matrix is room-scoped, ``--all`` needs a configured admin everywhere.TÚidr    F©r^  N)	rN  r   rN   rº   r   r0  r2  r)  rb  )r±   r·   rj   re  rÙ   s   &&&& r   Ú_resume_row_visibleÚ/GatewaySessionCommandsMixin._resume_row_visible�  s€   é € ÷ ˜×5Ñ5°f×=Ò=ÙÜ�#—'‘'˜$“-×%Ð% 2Ó&ˆØ�?‰?œhŸo™oÔ-Ø×)Ñ)¨&×2UÑ2UÐVYÓ2ZÓ[Ð[Ø×0Ñ0°ÈUÐ0ÓS×SÐSÑSùs   ‚B$¢B$ÁAB$ÂB"ÂB$c               ó    € V ^8„  d   QhRRRR/# rÌ   r   )r   s   "r   r   r¨   ©  s   € ÷ F0ñ F0°ð F0À#ñ F0r   c           
   ƒ  óp  aa"  € ^ RI HpHpHpHo VP
                  pV P                  P                  V4      G Rj  x€L
 pV P                  VP                  4      p T;'       d4    \        P                  ! VP                  VP                  4      G Rj  x€L
 pV P                  P                  VP                  4      G Rj  x€L
 o\'        TT3R l\)        \+        S4      ^,
          RR4       4       R4      p	T	f   \-        R4      #  T! ST	4      w  r«T! TP/                  R4      4      pT! ST	,          4      w  rÞT P3                  Y\4      pTe   T# T'       d   T P5                  YYxY¬TRJ4      G Rj  x€L
 # TeK    T P                  P7                  TP                  ^RR7      G Rj  x€L
 pTf   \-        R4      # TR,          pMBT P                  P9                  TP                  T
RRR7      G Rj  x€L
 '       g   \-        R4      # ^ Tn        T P=                  RYVP                  4       ^ RIH p \C        T\D        PF                  TTPH                  TPJ                  R7      pT! TT4       T PM                  T4      G Rj  x€L
 #  ELJ ELô ELÊ  \         d    \        4       u # \          d0    \"        P%                  RTP                  RR7       \        4       u # i ; i  \0         d   p\-        R	TR
7      u Rp?# Rp?ii ; i EL“ ELa  \0         d   p\-        R	TR
7      u Rp?# Rp?ii ; i EL? L³5i)z6Handle /retry command - re-send the last user message.)Ú#history_before_user_originated_turnÚretryable_user_textÚsplit_user_originated_turnÚuser_originated_turn_viewNz+/retry could not read the active rows of %sTrä   c              3  óN   <"  € T F  pS! SV,          4      f   K  Vx € K  	  R # 5i©Nr   )rs   ÚirP   rp  s   & €€r   ru   ÚDGatewaySessionCommandsMixin._handle_retry_command.<locals>.<genexpr>¾  s'   øé € ð TÑ)H AÙ!:¸7À1½:Ó!F÷  šaÓ)Hùs   ƒ%›
%zgateway.retry.no_previousrH   úgateway.retry.unsafer3   )Úrequire_retryable_compositeúgateway.retry.failed_unchangedÚtarget_text)Úactive_onlyÚreject_active_turn_leaseÚretry©Úcarry_callback©ÚtextÚmessage_typer·   Úraw_messageÚchannel_promptrw   )'Úagent.context_compressorrm  rn  ro  rp  r·   rò   rö   Ú_retry_owned_storer‹   r•   r–   Úget_active_message_idsÚload_transcriptr   r   r_   rš   rý   r$  Úrangerƒ   r   rN   r  Ú_retry_readmission_replyÚ_retry_in_admissionÚrewind_sessionÚrewrite_transcriptÚlast_prompt_tokensÚ_record_model_frictionÚgateway.session_ingress_contextr}  r	   r
   ÚTEXTr�  r‚  Ú_handle_message)r±   rÍ   rm  rn  ro  r·   Úsession_entryÚownedÚpinnedÚlast_user_idxÚ	truncatedÚ	live_viewÚlast_user_msgÚhandoffÚ_r¢   Úreadmission_replyÚrewind_resultr}  ÚturnrP   rp  s   &&                  @@r   Ú_handle_retry_commandÚ1GatewaySessionCommandsMixin._handle_retry_command©  s  ùé € ÷	'ó 	'ð —‘ˆØ"×6Ñ6×LÑLÈVÓT×Tˆð ×'Ñ'¨×(@Ñ(@ÓAˆð	(Ø×nÐn¤W×%6Ò%6°u×7SÑ7SÐUb×UmÑUmÓ%n×nˆFØ ×4Ñ4×DÑDÀ]×E]ÑE]Ó^×^ˆGô õ T¬¬s°7«|¸aÕ/?ÀÀRÔ)Hó TØUYó[ˆàÒ ÜÐ0Ó1Ð1ð	8Ù#FÀwÐP]Ó#^Ñ ˆIÙ/°	·±¸iÓ0HÓIˆMÙ3°G¸MÕ4JÓK‰JˆGð !×9Ñ9¸&ÓPÐØÒ(Ø$Ð$çØ×1Ñ1Ø e°YÈwÐ^bÐObód÷ dð dàÒð<ð '+×&>Ñ&>×&MÑ&MØ!×,Ñ,¨aÈTð 'Nó 'S÷ !S�ð Ò$ÜÐ9Ó:Ð:Ø)¨-Õ8‰Mà×/Ñ/×BÑBØ×$Ñ$ i¸TÐ\`ð Có b÷ bö bäÐ5Ó6Ð6Ø+,ˆÔ(Ø×#Ñ# G¨V×5MÑ5MÔNõ 	CÜØ¬[×-=Ñ-=ÀfØ×)Ñ)¸%×:NÑ:NôPˆñ 	�u˜dÔ#Ø×)Ñ)¨$Ó/×/Ð/ò{ Uò
  oÚ^øÜ"ô 	(Ü%Ó'Ò'Üô 	(Ü�L‰LÐFÈ×H`ÑH`ÐkoˆLÔpÜ%Ó'Ò'ð	(ûô ô 	8ÜÐ+°3Ô7Õ7ûð	8úòdò!Søäô <ÜÐ/°sÔ;Õ;ûð<úòbñ 0ùs  „7L6»J¼L6ÁJ Á%/J ÂJÂ,J ÃJÃJ ÃAL6Ä3K! Ä;L6ÅL6Å3LÅ4L6Å=+L Æ(L	Æ)L Æ-AL6Ç2L1Ç3	L6Ç=BL6Ê L4ÊL6ÊJ ÊJ ÊKÊ#L6Ê%KÊ.-KËL6ËKËL6Ë!LË,K>Ë8LË9L6Ë>LÌL6Ì	L ÌL.ÌL)Ì#L.Ì$L6Ì)L.Ì.L6Ì4L6c               ó   € V ^8„  d   QhRR/# )r   r‹   r   r   )r   s   "r   r   r¨   ñ  s   € ÷ 	Eñ 	E¨Sñ 	Er   c                óŽ   € ^ RI Hp V! V 4      pVf   R# V P                  P                  V4      pVe   WCP                  J d   V# R# )zòThe SessionDB that holds both *session_id*'s transcript and its authority's admission
ledger, or None (no authority: the rewrite-then-send path). One handle means one write
transaction can carry the rewrite and the admission (#139257 step 2).rÏ   N)rÑ   rÐ   rÕ   Ú_db_for_session_idr—   )r±   r‹   rÐ   r�   r—   s   &&   r   r„  Ú.GatewaySessionCommandsMixin._retry_owned_storeñ  sI   € õ 	AÙ$ TÓ*ˆ	ØÒÙØ×Ñ×2Ñ2°:Ó>ˆØ’^¨¯l©lÓ(:ˆrÐDÀÐDr   c               ó    € V ^8„  d   QhRRRR/# )r   Ú	compositerB   r   úOptional[str]r   )r   s   "r   r   r¨   ü  s   € ÷ :*ñ :*Ø-1ð:*Ø6Cñ:*r   c              ƒ  ó  a aaaaaaa"  € ^ RI Hp ^ RIHp	 ^ RIHp
 ^ RIHp SP                  oV'       d`    \        P                  ! SP                  SRRRR7      G Rj  x€L
 oSP$                  S8w  d   \        R4      # SP&                  pTTT3R lpM	VVVV3R lpVV VV3R lpVP)                  SSSP*                  WÞR7      p\-        V\.        P0                  SP*                  SP2                  SP4                  R7      pV	! SV4       VP7                  V4      p S P9                  V4      G Rj  x€L
 VP;                  V4       #  Lç  \         d9   p\        YÊ4      '       d   \        R4      u Rp?# \        R	TR
7      u Rp?# Rp?i\         d'    \         P#                  RSRR7       \        R4      u # i ; i LŒ  TP<                   d>   p\         P?                  RST4       \        R4      u Rp?TP;                  T4       # Rp?iT d[   pTP@                  '       gC   TPB                  R8X  d2   \        RS PE                  4       R7      u Rp?TP;                  T4       # h Rp?ii ; i  TP;                  T4       i ; i5i)zÞPlan the rewrite, bind it to the re-send and let ``admit_native`` commit both in one write
(``gateway.session_retry_admission``). A refusal leaves the transcript as it was; a
transcript changed since the read refuses both.)Úsession_retry_admissionr|  )ÚRewindTargetUnavailableError©rˆ   T)Úrequire_retryableÚrequire_compositeNrw  ru  r3   z"/retry carrier plan refused for %srä   c           
     ón   <€ ^ RI Hp V! SV SSP                  RSP                  SP                  R7       R# )é    )Úrewind_in_transactionT)Úpreserve_compaction_handoffÚexpected_active_idsÚexpected_target_contentN)Ú hermes_state_mutation_transcriptr®  Útarget_row_idr°  r±  )Úconnr®  r—   Úplanr‹   s   & €€€r   ÚwriteÚ>GatewaySessionCommandsMixin._retry_in_admission.<locals>.write  s2   ø€ ÝRÙ% b¨$°
¸D×<NÑ<NÐlpØ:>×:RÑ:RØ>B×>ZÑ>Z÷\r   c           
     ór   <€ SP                  T SS Uu. uF  p\        V4      NK  	  upR R SR7       R# u upi )T)ry  rz  r°  N)Úreplace_messages_in_transactionr&   )r´  rR   r—   r“  r‹   r•  s   & €€€€r   r¶  r·    s@   ø€ Ø×2Ñ2°4¸ÑW`ÓEaÑW`ÐRSÄdÈ1ÆgÑW`ÑEaÐosØLPÐflð 3ö nùÒEas   “4c                 ó†   <€ SP                   P                  S4       ^ Sn        SP                  RS P                  S4       R# )r­  r{  N)rÕ   Ú_clear_dirty_transcriptrŒ  r�  r·   )rÍ   r±   r‘  r‹   s   €€€€r   Ú	committedÚBGatewaySessionCommandsMixin._retry_in_admission.<locals>.committed   s5   ø€ Ø×Ñ×6Ñ6°zÔBØ/0ˆMÔ,Ø×'Ñ'¨°·±¸zÖJr   )r—   r‹   r·   r¶  Ú	on_commitr~  z7/retry refused with the transcript unchanged for %s: %sÚruntime_drainingúgateway.busy.drain_rejected©Úactionrw   )#Úgatewayr§  rŽ  r}  Úhermes_state_rewindr¨  r”   rˆ   r‹   r•   r–   Úplan_user_turn_rewindr  r`  r   ÚRuntimeErrorrš   rý   r°  Ú	live_textÚRetryRewriter·   r	   r
   r�  r�  r‚  Úbindr�  ÚunbindÚRetryRewriteRefusedÚinfoÚappliedrœ   Ú_status_action_gerund)r±   rÍ   r‘  r—   r“  r•  Úresend_textr¤  Úretry_admissionr}  r¨  rˆ   r¢   r¶  r¼  Úrewriterœ  Útokenrµ  r‹   s   ffffff&&          @@r   r‰  Ú/GatewaySessionCommandsMixin._retry_in_admissionü  s<  ÿé € õ
 	GÝBÝDÝ:Ø"×-Ñ-ˆ
ßð	;Ü$×.Ò.¨r×/GÑ/GÈÐUWØAEÐY]ô_÷ _�ð ×'Ñ'¨6Ô1ÜÐ9Ó:Ð:ØŸ.™.ˆK÷\ð \÷nð n÷	Kð 	Kð "×.Ñ.°"ÀÐTY×T`ÑT`Ø5:ð /ó QˆäØ¬;×+;Ñ+;ÀEÇLÁLØ×)Ñ)¸%×:NÑ:NôPˆñ 	�u˜dÔ#Ø×$Ñ$ WÓ-ˆð	*Ø×-Ñ-¨dÓ3×3ð ×"Ñ" 5Õ)ñ[_øäô <Ü˜c×@Ò@ÜÐ=Ó>Õ>ÜÐ/°sÔ;Õ;ûÜô ;Ü—‘ÐAÀ:ÐX\�Ô]ÜÐ9Ó:Ò:ð;úñ: 4øØ×2Ñ2ô 	7Ü�K‰KÐQÐS]Ð_bÔcÜÐ5Ó6Ô6ð ×"Ñ" 5Õ)ûð !ô 	Ø—?—?�? s§z¡zÐ5GÔ'GäÐ6¸t×?YÑ?YÓ?[Ô\Ô\ð ×"Ñ" 5Õ)ð ûð		ûð ×"Ñ" 5Õ)üsé   Š-J¸(E
 Á EÁ!E
 Á%B8JÄG Ä2F?Ä3G Ä6JÅE
 Å
F<ÅFÅ0F<Å1JÅ6FÆF<ÆJÆF<Æ$F<Æ9JÆ;F<Æ<JÆ?G ÇI.Ç!H
Ç3I.Ç4I1 Ç8JÈ
I.ÈI.È=I)ÉI.ÉI1 ÉJÉ(I)É)I.É.I1 É1JÊJc               ó$   € V ^8„  d   QhRRRRRR/# )r   r·   r   rÏ  r   r   r¥  r   )r   s   "r   r   r¨   8  s'   € ÷ Xñ X¨}ð XÈ3ð XÐS`ñ Xr   c                ó  € \        V\        P                  VR7      pV P                  W1R4      pVe   V# \	        V RR4      '       d   \        R4      # V P                  V4      pVe   V# V P                  V P                  V4      4      # )u0  Refusal the /retry re-send would meet in ``_handle_message``, if any â€” checked before the
transcript rewrite so a refused /retry leaves the transcript untouched.  Mirrors the gates
the re-sent plain-text turn passes after canonical command dispatch: the emergency-stop
pause (canonical commands pass it, plain turns do not), the external-drain new-turn refusal
and the active-session cap.  Not race-free â€” a drain can engage or the cap can fill between
this check and the re-send â€” but every refusal known up front is answered with the
transcript intact.)r  r€  r·   FÚ_external_drain_activez!gateway.busy.draining_maintenance)	r	   r
   r�  Ú_hm_estop_gater!   r   Ú_retry_authority_refusalÚ_active_session_limit_messagerÓ   )r±   r·   rÏ  ÚresendÚpaused_noticeÚauthority_replys   &&&   r   rˆ  Ú4GatewaySessionCommandsMixin._retry_readmission_reply8  s‹   € ô  ;¼[×=MÑ=MÐV\Ô]ˆØ×+Ñ+¨F¸EÓBˆØÒ$Ø Ð Ü�4Ð1°5×9Ò9ÜÐ8Ó9Ð9Ø×7Ñ7¸Ó?ˆØÒ&Ø"Ð"Ø×1Ñ1°$×2NÑ2NÈvÓ2VÓWÐWr   c               ó    € V ^8„  d   QhRRRR/# )r   r·   r   r   r¥  r   )r   s   "r   r   r¨   K  s   € ÷ ñ ¨}ð Àñ r   c                óÒ  € ^ RI Hp V! V 4      pVf   R# ^ RIp^ RIHp  VP	                  4        T P                  P                  T P                  T4      4      pTf   R# TP                  TP                  TP                  TP                  4      R7      p\        R T 4       4      TP                  8¼  d	   ^ RIHp T# R#   T d    \        RT P                  4       R7      u # i ; i)	zíThe routed authority's own admission refusals for the re-send (#139257): a draining or
retiring runtime (``runtime_draining``) and a full FIFO (``queue_full``), the gates
``admit_native`` applies. Same not-race-free caveat as the caller.rÏ   Nr©  rÀ  rÁ  rŠ   c              3  ó8   "  € T F  qR ,          R8H  x € K  	  R# 5i)rŒ   ÚqueuedNr   )rs   rj   s   & r   ru   ÚGGatewaySessionCommandsMixin._retry_authority_refusal.<locals>.<genexpr>^  s   é € Ð9±D¨S�8�} Ö(³Dùs   ‚)ÚQUEUE_FULL_REPLY)rÑ   rÐ   r”   rˆ   Ú_require_admission_openr   rÎ  rÕ   Úlookup_by_session_keyrÓ   r‰   r—   rÔ   r‹   ÚsumÚADMISSION_QUEUE_MAXÚgateway.session_ingressrã  )	r±   r·   rÐ   r�   r”   rˆ   r'  rž   rã  s	   &&       r   rØ  Ú4GatewaySessionCommandsMixin._retry_authority_refusalK  sß   € õ 	AÙ$ TÓ*ˆ	ØÒÙÛ#Ý:ð	YØ×-Ñ-Ô/ð ×"Ñ"×8Ñ8¸×9UÑ9UÐV\Ó9]Ó^ˆØŠ=ÙØ#×;Ñ;Ø�L‰L Y×%<Ñ%<¸U×=MÑ=MÓ%Nð <ó PˆäÑ9±DÓ9Ó9Ð=Q×=eÑ=eÔeÝ@Ø#Ð#Ùøð !ô 	YÜÐ2¸4×;UÑ;UÓ;WÔXÒXð	Yús    C Ã"C&Ã%C&c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   Úsignalr   r‹   ÚturnsÚintr   rY   r   )r   s   "r   r   r¨   c  s0   € ÷ \ñ \¨Sð \Àcð \ÐRUð \Ð^bñ \r   c                ó  € ^ RI Hp Rp\        \        V RR4      RR4      '       d=   \        P                  ! \
        4      ;_uu_ 4        V P                  V4      pRRR4       V! WWdR7       R#   + '       g   i     L; i)zuSlash dispatch does not install the routed profile's scope, so a multiplexed runner
names the owning home explicitly.)Úrecord_model_frictionNrD  Úmultiplex_profilesF)r‹   Úhermes_homerì  )Ú-hermes_cli.observability.shared_metrics_modelrï  r!   r]   r^   r_   Ú _resolve_profile_home_for_source)r±   rë  r·   r‹   rì  rï  Úhomes   &&&&&  r   r�  Ú2GatewaySessionCommandsMixin._record_model_frictionc  s_   € õ 	XØˆÜ”7˜4 ¨4Ó0Ð2FÈ×NÒNÜ×$Ò$¤Y×/Õ/Ø×<Ñ<¸VÓD�÷ 0á˜fÈ×[÷ 0×/ús   Á	A/Á/A?	c               ó    € V ^8„  d   QhRRRR/# rÌ   r   )r   s   "r   r   r¨   m  s   € ÷ Añ A°ð AÀñ Ar   c              ƒ  ó   "  € VP                   p^pVP                  4       P                  4       pV'       d,    \        ^\	        VP                  4       ^ ,          4      4      pV P                  P                  V4      G Rj  x€L
 pV P                  P                  VP                  V4      G Rj  x€L
 pVf   \        R4      # ^ Vn        T P                  RY%P                  VP                  R4      ;'       g    ^4        V P                  V P!                  V4      4       VR,          p\)        V4      ^È8”  d   VR	,          R
,           MTp	\        RVR,          VR,          V	R7      #   \         d&    \        RTP                  4       ^ ,          R7      u # i ; i EL Lï  \"         d!   p\$        P'                  RT4        Rp?L¦Rp?ii ; i5i)uÊ   Handle /undo [N] â€” back up N user turns (default 1), soft-deleting the truncated rows and
echoing the backed-up text; evicts the cached agent so the next turn rebuilds from the
active-only transcript.zgateway.undo.invalid_count)ÚargNzgateway.undo.nothingÚundoÚturns_undonez'undo: cached-agent eviction skipped: %srx  :NéÈ   Nz...zgateway.undo.removedÚrewound_count)rì  r’   Úpreview)r·   rø   r‚   Úmaxrí  Úsplitr  r   rò   rö   rŠ  r‹   rŒ  r�  rN   rï   rÓ   r_   rš   rý   rƒ   )
r±   rÍ   r·   ÚnÚraw_argsr‘  Úresultr  rx  rý  s
   &&        r   Ú_handle_undo_commandÚ0GatewaySessionCommandsMixin._handle_undo_commandm  s˜  é € ð —‘ˆØˆØ×)Ñ)Ó+×1Ñ1Ó3ˆßðPÜ˜œ3˜xŸ~™~Ó/°Õ2Ó3Ó4�ð #×6Ñ6×LÑLÈVÓT×TˆØ×/Ñ/×>Ñ>¸}×?WÑ?WÐYZÓ[×[ˆØŠ>ÜÐ+Ó,Ð,Ø+,ˆÔ(Ø×#Ñ# F¨F×4LÑ4LÈfÏjÉjÐYgÓNh×NmÐNmÐlmÔnð	Gð ×$Ñ$ T×%AÑ%AÀ&Ó%IÔJð ˜]Õ+ˆÜ/2°;Ó/?À#Ô/E�+˜dÕ# eÖ+È;ˆÜÐ'¨v°nÕ/EØ˜oÕ.¸ôAð 	Aøô! ô PÜÐ5¸8¿>¹>Ó;KÈAÕ;NÔOÒOðPúâTÙ[øô ô 	GÜ�L‰LÐBÀA×FÑFûð	Güsx   ‚5G¸*E( Á"GÂ FÂ-GÂ.FÂ/AGÃ8GÄ  F  Ä AGÅ(-FÆGÆFÆGÆGÆ GÆ+GÇGÇGÇGc               ó    € V ^8„  d   QhRRRR/# rÌ   r   )r   s   "r   r   r¨   Œ  s   € ÷ Dñ D°Lð DÀSñ Dr   c              ƒ  óN  "  € \        \        V RR4      RR4      '       g   V P                  V4      G Rj  x€L
 # ^ RIHp V! V P	                  VP
                  4      4      ;_uu_ 4        V P                  V4      G Rj  x€L
 uuRRR4       #  LW L  + '       g   i     R# ; i5i)u  Profile-scoping wrapper around manual /compress: multiplexed gateways resolve credentials
through the fail-closed per-profile secret scope, which slash dispatch (unlike ``_run_agent``)
does not install â€” unscoped, /compress would raise ``UnscopedSecretError``.rD  Nrð  F)Ú_profile_runtime_scope)r!   Ú_handle_compress_command_innerÚgateway.runr  ró  r·   )r±   rÍ   r  s   && r   Ú_handle_compress_commandÚ4GatewaySessionCommandsMixin._handle_compress_commandŒ  sƒ   é € ô ”w˜t X¨tÓ4Ð6JÈE×RÒRØ×<Ñ<¸UÓC×CÐCÝ6Ù# D×$IÑ$IÈ%Ï,É,Ó$W×XÕXØ×<Ñ<¸UÓC×C÷ YÒXñ Dñ D÷ Y×XÐXüs9   ‚3B%µB¶3B%Á)BÁ>BÁ?BÂB%ÂBÂB"	Â	B%c               ó$   € V ^8„  d   QhRRRRRR/# )r   r§   r   r‹   r   r   )r   s   "r   r   r¨   –  s#   € ÷ 6ñ 6ÀCð 6ÐUXð 6Ð]`ñ 6r   c              ƒ  ó˜  aa"  € ^ RI Hp V P                  VRR7      oSe   SVJ g   \        SRR4      f   \	        R4      # \        SRR4      p\        VR^ 4      p V P                  VV3R	 l4      G Rj  x€L
  \        TR^ 4      T8”  d   \	        R4      # \	        R4      #  L,  \         d   p\	        R
TR7      u Rp?# Rp?ii ; i5i)a  Manual /compress for codex_app_server sessions: compacts the LIVE cached agent's
app-server thread (``force=True`` bypasses the ``codex_app_server_auto`` gate) and keeps it
cached. A temporary agent or a mirror rewrite cannot shrink the server-side thread.

See #73503.
)Ú_AGENT_PENDING_SENTINELT)Úlockless_fallbackNÚ_codex_sessionzgateway.compress.codex_nothingÚcontext_compressorÚcompression_countc                 óB   <€ S P                  . R RS;'       g    RR7      # )r    TÚdefault)r0   Útask_id)Ú_compress_context)Úagentr‹   s   €€r   Ú<lambda>ÚPGatewaySessionCommandsMixin._compress_codex_app_server_session.<locals>.<lambda>¦  s"   ø€ ˜×/Ñ/°°B¸dÈJ×LcÐLcÐZcÐ/Ôdr   úgateway.compress.failedr3   z gateway.compress.codex_compactedz!gateway.compress.codex_incomplete)r	  r  r«   r!   r   Ú_run_in_executor_with_contextr_   )r±   r§   r‹   r  r9   Úcount_beforer¢   r  s   &&f    @r   Ú"_compress_codex_app_server_sessionÚ>GatewaySessionCommandsMixin._compress_codex_app_server_session–  sÙ   ùé € õ 	8à×&Ñ& {ÀdÐ&ÓKˆØŠ=˜EÐ%<Ó<ÄÈÐO_ÐaeÓ@fÒ@nÜÐ5Ó6Ð6Ü˜UÐ$8¸$Ó?ˆ
Ü˜zÐ+>ÀÓBˆð	;Ø×4Ñ4Ýdóf÷ fð fô �:Ð2°AÓ6¸ÔEÜÐ7Ó8Ð8ÜÐ4Ó5Ð5ñføäô 	;ÜÐ.°cÔ:Õ:ûð	;üsH   „AC
ÁB% Á6B#Á7B% Á;(C
Â#B% Â%CÂ0CÂ<CÂ=C
ÃCÃC
c               ó    € V ^8„  d   QhRRRR/# rÌ   r   )r   s   "r   r   r¨   ­  s   € ÷ 9ñ 9¸,ð 9È3ñ 9r   c              ƒ  óP  "  € ^ RI HpHp VP                  pV P                  P                  V4      G Rj  x€L
 p V P                  P                  VP                  4      G Rj  x€L
 pT'       d   \        T4      T8  d   \        R4      # T! TP                  4       ;'       g    R4      pTP                  '       d   \        R4      MRpTP                  '       d   TP                  '       g   T# TP                  '       d-   \        YgP                   TP"                  TP$                  T4      #  T P'                  YEYg4      G Rj  x€L
 #  EL Lè  \         d    \        4       u # i ; i L$  \(         d.   p	\*        P-                  RT	4       \        RT	R7      u Rp	?	# Rp	?	ii ; i5i)	z®Handle /compress -- manually compress conversation context; ``/compress <focus>`` tells
the summariser what to preserve. Flags/positional forms are parsed by the shared core.)ÚMIN_MESSAGESÚparse_compress_argsNzgateway.compress.not_enoughr    z'gateway.compress.aggressive_unsupportedzManual compress failed: %sr  r3   )Ú%agent.conversation_compression_manualr!  r"  r·   rò   rö   r†  r‹   r   r   rƒ   r   rø   Ú
aggressiverý  rV   rA   rQ   r:   Ú_run_manual_compressionr_   rš   r›   )
r±   rÍ   r!  r"  r·   r‘  rP   ÚrequestÚ	_agg_noter  s
   &&        r   r  Ú:GatewaySessionCommandsMixin._handle_compress_command_inner­  sU  é € ÷ 	\à—‘ˆØ"×6Ñ6×LÑLÈVÓT×Tˆð	(Ø ×4Ñ4×DÑDÀ]×E]ÑE]Ó^×^ˆG÷ œ#˜g›,¨Ô5ÜÐ2Ó3Ð3Ù% e×&<Ñ&<Ó&>×&DÐ&DÀ"ÓEˆØDK×DV×DVÐDV”AÐ?Ô@Ð\^ˆ	Ø××Ð g§o§o oØÐØ�?�?ˆ?Ü*¨7·O±OÀW×EVÑEVÐX_×XkÑXkÐmvÓwÐwð	9Ø×5Ñ5°fÈWÓ^×^Ð^ò Uá^øÜ"ô 	(Ü%Ó'Ò'ð	(úñ _øÜô 	9Ü�N‰NÐ7¸Ô;ÜÐ.°aÔ8Õ8ûð	9üsª   ‚3F&µE	¶F&»(E Á#EÁ$E Á(F&Á03F&Â$F&Â=F&ÃF&Ã.F&Ä,F&Ä/E+ ÅE)ÅE+ ÅF&ÅE ÅE&Å#F&Å%E&Å&F&Å)E+ Å+F#Å6"FÆF#ÆF&ÆF#Æ#F&c               ó    € V ^8„  d   QhRRRR/# )r   rP   Úlistr   r   r   )r   s   "r   r   r¨   Æ  s   € ÷ 1dñ 1dÈDð 1dÐ^añ 1dr   c              ƒ  ó6  aaaaa"  € ^ RI Hp ^ RIHoHp ^ RIHp V P                  V4      pVP                  '       d   V! VP                  4      MRp	V P                  WR7      w  r«\        VP                  R4      ;'       g    R4      P                  4       R8X  d%   V P                  VSP                  4      G Rj  x€L
 # VP                  R	4      '       g   \        R
4      # V Uu. uF  qÌP                  R4      R9   g   K  VNK  	  upoV	e   W›R&   W‹R&   V P!                  WR7      VR&   V P#                  SP                  W«4      G Rj  x€L
 o V P%                  VVVVV3R l4      G Rj  x€L
 pVP&                  R8X  dB   \        R4      V! SRR7       V P)                  V4       V P+                  SRR7      G Rj  x€L
  # VP&                  R8w  dN   RP-                  V! V4      4      V! SRR7       V P)                  V4       V P+                  SRR7      G Rj  x€L
  # V P/                  SSWP0                  4      G Rj  x€L
  V! SRR7       SP2                  pVP4                  pV! SRR7       V P)                  V4       V P+                  SRR7      G Rj  x€L
  RP-                  \7        WþSP8                  4      4      #  EL	u upi  EL� ELb EL L¸ L” L>  T! SRR7       T P)                  T4       T P+                  SRR7      G Rj  x€L 
  i ; i5i)zYBuild a temporary agent, run the shared compress core, persist, and describe the outcome.)Ú0finalize_context_engine_compression_notification)Úcompress_nowÚrender_compress_result)Ú_platform_config_keyNr½   Úapi_moder    Úcodex_app_serverÚapi_keyzgateway.compress.no_providerrG   rº   Úgateway_session_key)r·   r6   Úreasoning_configc            	     óH   <€ S ! SSSR RSP                   ;'       g    RR7      # )r    Tr  )Úsystem_messageÚskip_without_windowr  rŠ   )r-  Úmsgsr&  r‘  Ú	tmp_agents   €€€€€r   r  ÚEGatewaySessionCommandsMixin._run_manual_compression.<locals>.<lambda>è  s'   ø€ ™ Y°°gÈbÐfjØ-:×-EÑ-E×-RÐ-RÈõTr   Únothing_to_dozgateway.compress.nothing_to_doF)r¼  zmanual compression)ÚcontextÚ
compressedrI   T>   ÚtoolrJ   rK   )Úagent.conversation_compressionr,  r#  r-  r.  r	  r/  rÓ   rº   Ú_resolve_session_agent_runtimer   rN   r7  r  r‹   r   Ú!_resolve_session_reasoning_configÚ_build_manual_compression_agentr  rŒ   rï   Ú!_cleanup_agent_resources_off_looprO   Ú_persist_manual_compressionÚafter_messagesr  r%   r?   r:   )r±   r·   r‘  rP   r&  r,  r.  r/  r§   Úplatform_keyr6   Úruntime_kwargsrR   r  r9   r%   r-  r8  r9  s   &&f&f           @@@r   r%  Ú3GatewaySessionCommandsMixin._run_manual_compressionÆ  së  üé € åcß^Ý4à×2Ñ2°6Ó:ˆð AGÇÇÀÑ+¨F¯O©OÔ<ÐUYˆØ $× CÑ CÈ6Ð CÓ kÑˆÜˆ~×!Ñ! *Ó-×3Ð3°Ó4×:Ñ:Ó<Ð@RÔRð ×@Ñ@ÀÈm×NfÑNfÓg×gÐgØ×!Ñ! )×,Ò,ÜÐ3Ó4Ð4ñ #ÓU™7�a§e¡e¨F£mÐ7TÑ&T—�™7ÑUˆð Ò#Ø)5˜:Ñ&Ø0;Ð,Ñ-ð .2×-SÑ-SÐ[aÐ-SÓ-oˆÐ)Ñ*à×>Ñ>¸}×?WÑ?WÐY^Óo×oˆ	ð	bð  ×=Ñ=÷Tð TóU÷ UˆFð �}‰} Ô/ÜÐ9Ó:ñ =¸YÐRWÕXØ×$Ñ$ [Ô1à×8Ñ8¸ÐL`Ð8Óa×aÑað �}‰} Ô,Ø—y‘yÑ!7¸Ó!?Ó@ñ =¸YÐRWÕXØ×$Ñ$ [Ô1à×8Ñ8¸ÐL`Ð8Óa×aÑað ×2Ñ2°9¸mÈV×UjÑUjÓk×kÐkÙ<¸YÐRVÕWØ"×5Ñ5ˆJØ—n‘nˆGá<¸YÐRWÕXØ×$Ñ$ [Ô1à×8Ñ8¸ÐL`Ð8Óa×aÐaØ�y‰yÔ8¸Èg×NaÑNaÓbÓcÐcòG hùò
 Vò pòUô bñ lñ bøñ =¸YÐRWÕXØ×$Ñ$ [Ô1à×8Ñ8¸ÐL`Ð8Óa×aÒaüsÓ   ‡B6LÂ=KÂ>LÃLÃ(K	ÄK	Ä
ALÅKÅLÅK Å/KÅ0K Æ1LÇ KÇLÇ'K Ç-1LÈKÈLÈ$ K ÉKÉ&K É+1LÊKÊ*LË	LËK ËLËLËK ËLË2LÌLÌLÌLc               ó    € V ^8„  d   QhRRRR/# )r   r‹   r   rG  r&   r   )r   s   "r   r   r¨   ù  s   € ÷ &ñ &Àð &Ð\`ñ &r   c              ƒ  óR  "  € ^ RI Hp ^ RIHpHp ^ RIHp ^ RIHp Rp	\        V P                  RR4      p
\        V
4      '       d    V
! V4      G Rj  x€L
 p	T! V! 4       ;'       g    / P                  R
4      ;'       g    / P                  R4      RR7      pV! R/ VBRVR^RRRV'       * RR.RVR\        V P                  RV P                  4      /B pV! WÙ4       W]n        R Vn        RVn        V#  L¡  \         d#   p\        P                  RYRR	7        Rp?LÇRp?ii ; i5i)zUBuild the throwaway AIAgent that performs a manual /compress rewrite of *session_id*.)ÚAIAgent)Ú_GATEWAY_HYGIENE_PLATFORMÚ_seed_hygiene_system_prompt)Úload_config)Úis_truthy_valueNra  z¡Manual compression could not restore the system prompt for session %s: %s. Preserving an empty prompt so the live turn rebuilds it with its configured providers.Trä   ÚcompressionÚcheckpoint_requiredF)r  r6   Úmax_iterationsÚ
quiet_modeÚskip_memoryÚenabled_toolsetsÚmemoryr‹   Ú
session_dbÚ_dbc                 ó   € R # rr  r   )ÚaÚkws   *,r   r  ÚMGatewaySessionCommandsMixin._build_manual_compression_agent.<locals>.<lambda>  s   € ©tr   r   )Ú	run_agentrK  r	  rL  rM  Úhermes_cli.configrN  ÚutilsrO  r!   rù   r#  r_   rš   r›   rN   rº   Ú	_print_fnÚ_end_session_on_close)r±   r‹   r6   rG  rK  rL  rM  Ú	_load_cfgÚ
_is_truthyÚsession_rowra  r¢   Ú_checkpoint_requiredr9  s   &&&&          r   rB  Ú;GatewaySessionCommandsMixin._build_manual_compression_agentù  sU  é € å%ßVÝ>Ý7ð ˆÜ˜d×.Ñ.°¸tÓDˆÜ�K× Ò ðBÙ$/°
Ó$;×;�ñ  *Ù‹k×Ð˜R×$Ñ$ ]Ó3×9Ð9°r×>Ñ>Ð?TÓUØô Ðñ ñ [˜nñ [°Eð [È!ð [ÐX\ð [Ø,@Ô(@ð[ØT\ÐS]ð[à'1ð[ô (/¨t×/?Ñ/?ÀÈ×HXÑHXÓ'Yò[ˆ	ñ 	$ IÔ;ð
 7ÔÙ3ˆ	Ôà*/ˆ	Ô'ØÐñ3 <øÜô BÜ—‘ð!à",¸Dð ÷ Bñ BûðBüsO   ‚AD'ÁC7 ÁC5ÁC7 ÁD'Á(D'ÂA4D'Ã5C7 Ã7D$ÄDÄD'ÄD$Ä$D'c               ó   € V ^8„  d   QhRR/# rX   r   )r   s   "r   r   r¨   !  s   € ÷ gñ gÐaeñ gr   c              ƒ  ó0  "  € VP                   pWRP                   8w  d—   V P                  P                  VP                   WT4      G Rj  x€L
 '       g   \        RV 24      hWRn         V P                  P	                  4       G Rj  x€L
  \
        P                  ! V P                  W2RR7      G Rj  x€L
  M(\        VRR4      '       g   \        P                  R4       V P                  P                  VP                  ^ R7      G Rj  x€L
  R#  LÅ L‹ Lb L5i)	a¦  Commit a manual /compress result to the session store.  Rotation (new continuation id)
makes the NEW session durable (already published, else rewritten) so the original stays searchable;
persist BEFORE repointing so a failed write is fatal and old history stays reachable.
In-place compaction already archived + inserted rows, and a rewrite would DELETE the
archive; an unchanged id without in-place means rotation FAILED.Nz4failed to persist compressed transcript for session zcompress-commandrß   Ú_last_compaction_in_placeFu§   Manual /compress: session rotation did not occur (session_id unchanged) and in-place mode is off â€” preserving original transcript instead of overwriting it (#44794).)rŒ  )r‹   rò   Ú!persist_rotated_compression_childrÆ  Ú_saver•   r–   Ú_sync_telegram_topic_bindingr!   rš   r›   Úupdate_sessionr§   )r±   r9  r‘  r·   r=  r¼   s   &&&&& r   rD  Ú7GatewaySessionCommandsMixin._persist_manual_compression!  s  é € ð #×-Ñ-ˆØ×5Ñ5Ô5à×1Ñ1×SÑSØ!×,Ñ,¨nóJ÷ Jö Jä"Ð%YÐZhÐYiÐ#jÓkÐkØ'5Ô$Ø×*Ñ*×0Ñ0Ó2×2Ð2Ü×#Ò# D×$EÑ$EÀvØ+=ô?÷ ?ñ ?ä˜Ð$?À×GÒGÜ�N‰Nðeôfð ×&Ñ&×5Ñ5°m×6OÑ6OÐdeÐ5Óf×fÒfñJñ 3ñ?ñ 	gùsO   ‚ADÁDÁ		DÁ1DÂDÂ*DÂ/DÂ0ADÄDÄDÄDÄDÄDc               ó$   € V ^8„  d   QhRRRRRR/# )r   rÍ   r	   Úargsr   r   r   )r   s   "r   r   r¨   9  s'   € ÷ A(ñ A(°ð A(ÀSð A(ÐRUñ A(r   c           	   ƒ  óT  "  € VP                   pVP                  \        P                  8w  g   VP                  R8w  d   \        R4      # V P                  '       g   V P                  4       #  V P                  V4      '       g   \        R4      #  VP                  4       P                  4       pVP                  4       R9   d   V P                  4       # VP                  4       R9   d   V P!                  V4      G Rj  x€L
 # V'       d7   VP"                  '       g   \        R4      # V P%                  W4      G Rj  x€L
 # V P'                  V4      G Rj  x€L
 pVP)                  R	4      '       du   RpVP)                  R
4      RJ d   RpMVP)                  R4      RJ d   RpV'       d<   V P+                  V4      '       d   V P-                  V4      G Rj  x€L
  \        V4      # V P/                  V4      p V P                  P1                  \3        VP4                  4      \3        VP6                  4      VVP)                  R
4      VP)                  R4      R7      G Rj  x€L
  TP"                  '       g3   T P;                  T4      G Rj  x€L
  T P=                  T4      G Rj  x€L
 #  T P                  P?                  \3        TP4                  4      \3        TP"                  4      TR7      G Rj  x€L
 pT'       g   \        R4      # \3        TP)                  R4      ;'       g    R4      p	 T P                  PA                  T	4      G Rj  x€L
 p
\        RT
;'       g    \        R4      T	R7      #   \         d    \        P                  RRR7        ELi ; i EL› EL` ELJ ELÍ ELG  \         d-   p\        P9                  R4       \        RTR7      u Rp?# Rp?ii ; i ELY ELC Lø  \         d    \        P                  RRR7       Rp ELi ; i LÊ  \         d    Rp
 L×i ; i5i)z:Handle /topic for Telegram DM user-managed topic sessions.Údmzgateway.topic.not_telegram_dmzgateway.topic.unauthorizedzTopic auth check failedTrä   Nz!gateway.topic.restore_needs_topicÚcheckedÚhas_topics_enabledFzgateway.topic.topics_disabledÚallows_users_to_create_topicsz$gateway.topic.topics_user_disallowed)r1  r¾   Úprofile_namert  ru  z$Failed to enable Telegram topic modezgateway.topic.enable_failedr3   )r1  r/  rv  z%Failed to read Telegram topic bindingzgateway.topic.thread_readyr‹   r    zgateway.topic.bound_statuszgateway.topic.untitled_session)Úlabelr‹   >   Ú?Úhelpú-hú--help>   ÚoffÚstopÚdisable)!r·   rº   r   ÚTELEGRAMr6  r   rù   Ú_session_db_unavailable_replyrÒ   r_   rš   rý   rø   r‚   r7  Ú_telegram_topic_help_textÚ%_disable_telegram_topic_mode_for_chatr/  Ú_restore_telegram_topic_sessionÚ _get_telegram_topic_capabilitiesrN   Ú%_should_send_telegram_capability_hintÚ _send_telegram_topic_setup_imageÚ_telegram_topic_profile_nameÚenable_telegram_topic_moder   r1  r¾   Ú	exceptionÚ_ensure_telegram_system_topicÚ#_telegram_topic_root_status_messageÚget_telegram_topic_bindingÚget_session_title)r±   rÍ   rp  r·   ÚcapabilitiesÚblocked_keyrv  r¢   Úbindingr‹   r  s   &&&        r   Ú_handle_topic_commandÚ1GatewaySessionCommandsMixin._handle_topic_command9  s¨  é € à—‘ˆØ�?‰?œh×/Ñ/Ô/°6×3CÑ3CÀtÔ3KÜÐ4Ó5Ð5Ø××ÐØ×5Ñ5Ó7Ð7ð	CØ×6Ñ6°v×>Ò>ÜÐ5Ó6Ð6ð ?ð
 ×%Ñ%Ó'×-Ñ-Ó/ˆØ�:‰:‹<Ð8Ô8Ø×1Ñ1Ó3Ð3Ø�:‰:‹<Ð5Ô5Ø×CÑCÀFÓK×KÐKßØ×#×#Ð#ÜÐ<Ó=Ð=Ø×=Ñ=¸eÓJ×JÐJà!×BÑBÀ6ÓJ×JˆØ×Ñ˜I×&Ò&ØˆKØ×ÑÐ 4Ó5¸Ó>Ø=‘Ø×!Ñ!Ð"AÓBÀeÓKØD�ßØ×=Ñ=¸f×EÒEØ×?Ñ?ÀÓG×GÐGÜ˜“~Ð%à×8Ñ8¸Ó@ˆð	?Ø×"Ñ"×=Ñ=Ü˜FŸN™NÓ+´S¸¿¹Ó5HÐWcØ#/×#3Ñ#3Ð4HÓ#IØ.:×.>Ñ.>Ð?^Ó._ð >ó a÷ að að ××ÐØ×4Ñ4°VÓ<×<Ð<Ø×AÑAÀ&ÓI×IÐIð	Ø ×,Ñ,×GÑGÜ˜FŸN™NÓ+´s¸6×;KÑ;KÓ7LØ)ð Hó +÷ +ˆG÷ ÜÐ1Ó2Ð2Ü˜Ÿ™ \Ó2×8Ð8°bÓ9ˆ
ð	Ø×*Ñ*×<Ñ<¸ZÓH×HˆEô Ð-°U×5aÐ5a¼aÐ@`Ó>aØ&ô(ð 	(øôi ô 	CÜ�L‰LÐ2¸TˆL×Bð	Cúò Lò KâJò Hò
aøô ô 	?Ü×ÑÐCÔDÜÐ2¸#Ô>Õ>ûð	?úò
 =ÚIñ+øô ô 	Ü�L‰LÐ@È4ˆLÔPØ‹Gð	úñ IøÜô 	ØŠEð	üs}  ‚AP(ÁP(Á-M. Â
M. ÂA.P(Ã<NÃ=P(Ä	P(ÄP(Ä:NÄ;P(ÅNÅP(Å/8P(Æ(P(Æ?P(ÇN Ç P(Ç5A'N& ÉN#ÉN& É!P(É3P(ÊO ÊP(Ê O#Ê!P(Ê&AO( Ë-O&Ë.O( Ë2P(Ë:'P(Ì"P(Ì*P ÍPÍ	P ÍP(ÍP(Í."NÎP(ÎNÎP(ÎP(ÎP(Î P(Î#N& Î&OÎ1!OÏOÏP(ÏOÏP(Ï#P(Ï&O( Ï($PÐP(ÐPÐP(ÐP ÐP%Ð"P(Ð$P%Ð%P(c               ó    € V ^8„  d   QhRRRR/# rÌ   r   )r   s   "r   r   r¨   ~  s   € ÷ ;#ñ ;#°ð ;#Àñ ;#r   c           	   ƒ  ó	  aaaa"  € ^ RI p^ RIHpHpHpHpHo VP                  4       P                  4       p\        V4      ;'       d    VR,          P                  4       R9   pV'       d   VRR pV'       g   V#  V! V^ ,          4      oTP                  p
T P                  P                  T
4      G Rj  x€L
 pTP                  pT P                   '       g   \#        R4      # \%        T4      ^8”  d
   T^,          MT! TS4      p\&        P(                  P+                  T4      ;'       g
    T! TS4      p^ RIHp  \0        P2                  ! YPP                   P4                  TS4      G Rj  x€L
 oS'       g   \#        RTR7      # T'       d   ^ RIHp T! S4      oTP=                  R	R
7      p\&        P(                  P?                  TT4      o R TTTT3R llp\0        P2                  ! T4      G Rj  x€L
  T PA                  T
4      pT'       gc   \#        R4      \B        PD                  ! \F        4      ;_uu_ 4        \&        PH                  ! S4       \&        PJ                  ! T4       RRR4       # TPM                  T
PN                  S\#        RTR7      TR7      G Rj  x€L
  \#        R4      \B        PD                  ! \F        4      ;_uu_ 4        \&        PH                  ! S4       \&        PJ                  ! T4       RRR4       #   \         d   p	T	 RT 2u Rp	?	# Rp	?	ii ; i ELq EL¾  T d   p	\7        T	4      u Rp	?	# Rp	?	ii ; i ELX  + '       g   i     # ; i LÀ  + '       g   i     # ; i  \F         d˜   p	\P        PS                  RT	4       \#        RT	R7      u Rp	?	\B        PD                  ! \F        4      ;_uu_ 4        \&        PH                  ! S4       \&        PJ                  ! T4       RRR4       #   + '       g   i     # ; iRp	?	ii ; i  \B        PD                  ! \F        4      ;_uu_ 4        \&        PH                  ! S4       \&        PJ                  ! T4       RRR4       i   + '       g   i     i ; i; i5i)uF   Handle /save â€” export the current session and send it as a document.N)Ú
SAVE_USAGEÚdefault_save_filenameÚload_save_snapshotÚnormalize_save_formatÚrender_session_for_saverê   z%gateway.shared.session_db_unavailable)ÚSessionExportTooLargeErrorzgateway.save.no_messagesrŠ   )Úredact_session_dataÚhermes_save_)Úprefixc               ó   € V ^8„  d   QhRR/# rX   r   )r   s   "r   r   ÚFGatewaySessionCommandsMixin._handle_save_command.<locals>.__annotate__¦  s   € ÷ &ñ & tñ &r   c                 ó¢   <€ S! SS4      p \        SR RR7      ;_uu_ 4       pVP                  V 4       RRR4       R#   + '       g   i     R# ; i)Úwzutf-8)ÚencodingN)Úopenr¶  )ÚrenderedÚfÚexport_dataÚfmtr™  Ú	temp_paths     €€€€r   Ú_render_and_writeÚKGatewaySessionCommandsMixin._handle_save_command.<locals>._render_and_write¦  s;   ø€ Ù2°;ÀÓD�Ü˜) S°7×;Õ;¸qØ—G‘G˜HÔ%÷ <×;×;Ò;ús	   ¡=½A	zgateway.save.no_adapterzgateway.save.caption)Úfilename)r1  Ú	file_pathÚcaptionÚ	file_namezgateway.save.completezSession /save failed: %szgateway.save.failedr3   rw   )Úredactz--redact)*ÚtempfileÚhermes_cli.session_exportr•  r–  r—  r˜  r™  rø   rÿ  rB   r7  r  r·   rò   rö   r‹   rù   r   rƒ   ÚosÚpathÚbasenamer  rš  r•   r–   rX  r   Úhermes_cli.session_export_mdr›  ÚmkdtemprO   Ú_delivery_adapter_forr]   r^   r_   ÚremoveÚrmdirÚsend_documentr1  rš   r›   )r±   rÍ   r°  r•  r–  r—  r˜  rm   r¯  r  r·   r‘  r‹   r«  rš  r›  Útemp_dirr©  Úadapterr¦  r§  r™  r¨  s   &&                 @@@@r   Ú_handle_save_commandÚ0GatewaySessionCommandsMixin._handle_save_command~  sj  ûé € ã÷	sõ 	sð ×&Ñ&Ó(×.Ñ.Ó0ˆÜ�e“×LÐL  r¥§¡Ó!2Ð6LÑ!LˆßØ˜#˜2�JˆEßØÐð	*Ù'¨¨a­Ó1ˆCð —‘ˆØ"×6Ñ6×LÑLÈVÓT×TˆØ"×-Ñ-ˆ
Ø××ÐÜÐ<Ó=Ð=ä" 5›z¨Aœ~�5˜–8Ñ3HÈÐUXÓ3YˆÜ—7‘7×#Ñ# HÓ-×WÐWÑ1FÀzÐSVÓ1WˆÝ;ð	ä '× 1Ò 1Ð2D×FVÑFV×FZÑFZÐ\fÐhkÓ l×lˆK÷ ÜÐ/¸JÔGÐGßÝHÙ-¨kÓ:ˆKØ×#Ñ#¨>Ð#Ó:ˆÜ—G‘G—L‘L ¨8Ó4ˆ	ð	#÷&ó &ô
 ×#Ò#Ð$5Ó6×6Ð6à×0Ñ0°Ó8ˆGßÜÐ2Ó3ô ×$Ò$¤Y×/Õ/Ü—	’	˜)Ô$Ü—’˜Ô"÷ 0Ð/ð ×'Ñ'°·±È)Ü01Ð2HÐS[Ô0\Ðhpð (ó r÷ rð räÐ,Ó-ô
 ×$Ò$¤Y×/Õ/Ü—	’	˜)Ô$Ü—’˜Ô"÷ 0Ð/øôW ô 	*Ø�S˜˜Z˜LÐ)Õ)ûð	*úò Uò møØ)ô 	Ü�q“6�Mûð	úò  7÷ 0×/úñr÷ 0×/ûô	 ô 	5Ü�N‰NÐ5°qÔ9ÜÐ*°!Ô4Ô4ä×$Ò$¤Y×/Õ/Ü—	’	˜)Ô$Ü—’˜Ô"÷ 0×/×/Ð/þð		5ûô ×$Ò$¤Y×/Õ/Ü—	’	˜)Ô$Ü—’˜Ô"÷ 0×/×/Ð/ÿs‚  †A%R
Á,R
Á9R
Á<L Â*R
Â5L&Â6!R
ÃAR
Ä+R
Ä</L, Å+L)Å,L, Å0R
Å8R
ÆA R
Ç%M6 Ç3MÇ4M6 È
M6 È"R
È=-MÉ*	R
É3-M6 Ê M!Ê!M6 Ê/"R
Ë-M#Ë>	R
ÌL#ÌLÌL#ÌR
ÌL#Ì#R
Ì)L, Ì,MÌ3
MÌ=MÌ>R
ÍMÍR
ÍM6 ÍMÍR
Í!M6 Í#M3Í.R
Í6PÎ"PÎ#PÎ$P Î("R
Ï
-P Ï7	R
Ð PÐR
ÐPÐP Ð#RÐ>-Q4	Ñ+	RÑ4RÑ?RÒR
c               ó    € V ^8„  d   QhRRRR/# rÌ   r   )r   s   "r   r   r¨   »  s   € ÷ ):ñ ):°ð ):À#ñ ):r   c              ƒ  óˆ  "  € VP                   pV P                  P                  V4      G Rj  x€L
 pVP                  pV P                  '       g   V P                  4       # V P                  P                  V4      G Rj  x€L
 f¥   \        P                  ! \        4      ;_uu_ 4        V P                  P                  TVP                  '       d   VP                  P                  MRVP                  VP                  VP                  VP                   R7      G Rj  x€L
  RRR4       VP#                  4       P%                  4       pV'       gF   V P                  P                  V4      G Rj  x€L
 pV'       d   \'        RWFR7      # \'        RVR7      #  ^ RIHp VP-                  V4      pT'       g   \'        R4      #  T P                  P1                  YH4      G Rj  x€L
 '       g   \'        R4      #   \2        P4                  ! T P6                  Y$T4      G Rj  x€L
  \'        RTR7      #  EL  EL² EL  + '       g   i     EL; i LÜ  \.         d   p	\'        R	T	R
7      u Rp	?	# Rp	?	ii ; i L’  \.         d   p	\'        R	T	R
7      u Rp	?	# Rp	?	ii ; i L|  \         d    \8        P;                  RRR7        Lži ; i5i)uB   Handle /title command â€” set or show the current session's title.Nr�   )r‹   r·   r¾   r1  r6  r/  z gateway.title.current_with_title)r‹   r  zgateway.title.current_no_titlerŠ   r  zgateway.shared.warn_passthroughr3   zgateway.title.empty_after_cleanzgateway.title.not_foundz+Failed to rename Telegram topic from /titleTrä   zgateway.title.set_tor  )r·   rò   rö   r‹   rù   r€  r�  r]   r^   r_   Úcreate_sessionrº   r¿   r¾   r1  r6  r/  rø   r‚   r   r  r  r  r  r  r•   r–   Ú%_schedule_telegram_topic_title_renamerš   rý   )
r±   rÍ   r·   r‘  r‹   r  r  r  r  r  s
   &&        r   Ú_handle_title_commandÚ1GatewaySessionCommandsMixin._handle_title_command»  sT  é € à—‘ˆØ"×6Ñ6×LÑLÈVÓT×TˆØ"×-Ñ-ˆ
Ø××ÐØ×5Ñ5Ó7Ð7ð
 ×!Ñ!×3Ñ3°JÓ?×?ÒGÜ×$Ò$¤Y×/Õ/Ø×&Ñ&×5Ñ5Ø)Ø4:·O·O°O˜6Ÿ?™?×0Ò0ÈØ"ŸN™N°F·N±NÈf×N^ÑN^Ø$×.Ñ.ð	 6ó 0÷ 0ð 0÷ 0ð ×*Ñ*Ó,×2Ñ2Ó4ˆ	ßØ×*Ñ*×<Ñ<¸ZÓH×HˆEßÜÐ;È
Ô`Ð`ÜÐ5À*ÔMÐMð	AÝ.Ø!×0Ñ0°Ó;ˆI÷ ÜÐ6Ó7Ð7ð	AØ×)Ñ)×;Ñ;¸JÓR×RÖRÜÐ2Ó3Ð3ð Sð
	WÜ×#Ò# D×$NÑ$NÐPVÐdmÓn×nÐnô Ð'¨yÔ9Ð9òM Uò @ò0÷ 0×/Ð/úñ Iøô ô 	AÜÐ6¸aÔ@Õ@ûð	Aúñ
 Søäô 	AÜÐ6¸aÔ@Õ@ûð	Aúñ oøÜô 	WÜ�L‰LÐFÐQUˆLÖVð	Wüs  ‚+K­H-®!KÁ.KÁ>H0Á?(KÂ'A5H6ÄH3ÄH6Ä!-KÅKÅ-I
Å.KÅ:KÆI Æ,KÆ4KÇ I3 ÇI1Ç	I3 Ç)
I3 Ç3KÇ6%J ÈJÈJ È KÈ0KÈ3H6È6I	É
KÉI.ÉI)É#I.É$KÉ)I.É.KÉ1I3 É3JÉ>JÊ
JÊKÊJÊKÊJ Ê"J?Ê<KÊ>J?Ê?Kc               ó$   € V ^8„  d   QhRRRRRR/# )r   r§   r   re  rB   r   ú
list[dict]r   )r   s   "r   r   r¨   è  s'   € ÷ 	[ñ 	[¸sð 	[Ètð 	[ÐXbñ 	[r   c              ƒ  óÖ  "  € T;'       d    V P                  V4      pV P                  P                  VP                  '       d   VP                  P                  MRV'       d   RMT^
RR7      G Rj  x€L
 pV Uu. uF  qfP                  R4      '       g   K  VNK  	  upR,          pV Uu. uF&  q`P                  WV4      G Rj  x€L
 '       g   K$  VNK(  	  up#  Lhu upi  Lu upi 5i)zMTitled sessions visible to the caller (origin-scoped unless admin ``--all``).NT)r·   r§   ÚlimitÚorder_by_last_activer  ºNé
   N)rN  rù   Úlist_sessions_richrº   r¿   rN   ri  )r±   r·   r§   re  Úwidenr×   ÚsÚtitleds   &&&&    r   Ú_list_titled_sessionsÚ1GatewaySessionCommandsMixin._list_titled_sessionsè  sÄ   é € à×BÐB˜d×:Ñ:¸6ÓBˆð ×)Ñ)×<Ñ<Ø,2¯O¯O¨O�6—?‘?×(Ò(Àß %™¨;¸bÐW[ð =ó ]÷ ]ˆñ &Ó8™X˜¯©¨w¯—!�!™XÑ8¸Õ=ˆÙ!ÓZ™6�a×+CÑ+CÀFÈyÓ+Y×%YÓ%Y—�™6ÑZÐZñ	]ùò 9Ù%YùÒZùs`   ‚AC)ÁC)Á$C)Á2CÁ3C)Á;CÂCÂC)Â,C$ÃC"
ÃC$ÃC$ÃC)ÃC)Ã"C$Ã$C)c               ó$   € V ^8„  d   QhRRRRRR/# )r   r§   r   r   re  rB   r   )r   s   "r   r   r¨   ó  s"   € ÷ ñ Àð È3ð Ð[_ñ r   c              ƒ  óN  "  € VP                  4       '       d†    V P                  WV4      G Rj  x€L
 p\        T4      pT^8  g   T\        T4      8”  d   \        RTR7      # YW^,
          ,          pTP                  R4      TP                  R4      ;'       g    Tr9MWV P                  P                  V4      G Rj  x€L
 p
V
'       d
   V
R,          M"V P                  P                  V4      G Rj  x€L
 p	V	'       g   \        R	VR
7      #  V P                  P                  V	4      G Rj  x€L
 p	W“3#  EL  \         d.   p\        P	                  RT4       \        RTR7      u Rp?# Rp?ii ; i L² L€ LI  \         d#   p\        P	                  RY–4        Rp?Y“3# Rp?ii ; i5i)zW``(target_id, name)`` for a numbered choice, session id or title; else the error reply.Nz5Failed to list titled sessions for numeric resume: %súgateway.resume.list_failedr3   zgateway.resume.out_of_range)Úindexrg  r  zgateway.resume.not_found©r   z0Failed to resolve resume continuation for %s: %s)ÚisdigitrÐ  r_   rš   rý   r   rí  rƒ   rN   rù   ra  Úresolve_session_by_titleÚresolve_resume_session_id)r±   r·   r§   r   re  rÏ  r  rÕ  Útargetr]  Úsessions   &&&&&      r   Ú_resolve_resume_targetÚ2GatewaySessionCommandsMixin._resolve_resume_targetó  sg  é € à�<‰<�>Š>ð@Ø#×9Ñ9¸&ÈyÓY×Y�ô ˜“IˆEØ�qŒy˜E¤C¨£KÔ/ÜÐ6¸eÔDÐDØ A�IÕ&ˆFØ$Ÿj™j¨Ó.°·
±
¸7Ó0C×0KÐ0KÀt‘tà ×,Ñ,×8Ñ8¸Ó>×>ˆGß)0˜ ž¸D×<LÑ<L×<eÑ<eÐfjÓ<k×6kˆIßÜÐ/°dÔ;Ð;ð	[à"×.Ñ.×HÑHÈÓS×SˆIð ˆÐò) ZøÜô @Ü—‘ÐTÐVWÔXÜÐ5¸QÔ?Õ?ûð@úñ ?Ù6kñ TøÜô 	[Ü�L‰LÐKÈY×ZÐZØˆÐûð	[üs°   ‚F%šD4 ¯D1°D4 ´A%F%Â"F%Â<E/Â=F%Ã	'F%Ã0E1Ã1F%Ã=F%ÄE5 Ä)E3Ä*E5 Ä.F%Ä1D4 Ä4E,Ä?"E'Å!E,Å"F%Å'E,Å,F%Å1F%Å3E5 Å5F"Æ FÆF%ÆF"Æ"F%c          
     ó,   € V ^8„  d   QhRRRRRRRRRR/# )	r   r]  r   r   re  rB   Úallow_cross_roomr   r¥  r   )r   s   "r   r   r¨     s9   € ÷ @ñ @À3ð @Ècð @Ð^bð @Ø<@ð@ØERñ@r   c              ƒ  óž  "  € VP                   \        P                  8X  dp   V P                  V4      pV P	                  W4      '       g	   V'       d   R# Vf   \        RVR7      # \        RTVP                  ;'       g    VP                  R7      # T P                  YT;'       g    TR7      G Rj  x€L
 '       d   R# \        RVR7      #  L5i)uœ   IDOR guard: a session id/title is a routing handle, not authority â€” bind /resume to the
caller's own room (Matrix) or platform/user/chat (other adapters).Nz'gateway.resume.matrix_blocked_no_originrÖ  z(gateway.resume.matrix_blocked_other_room)r   Úroomrh  z gateway.resume.blocked_not_owner)	rº   r   r0  r)  r2  r   Ú	chat_namer1  rb  )r±   r·   r]  r   re  rß  Útarget_origins   &&&&&& r   Ú_resume_access_denied_replyÚ7GatewaySessionCommandsMixin._resume_access_denied_reply  s·   é € ð �?‰?œhŸo™oÔ-Ø ×?Ñ?À	ÓJˆMØ×%Ñ% f×<Ò<×@PÙØÒ$ÜÐBÈÔNÐNÜÐ?ÀdØ'×1Ñ1×JÐJ°]×5JÑ5JôLð Là×,Ñ,¨VÐPY×PmÐPmÐ]mÐ,Óo×oÖoÙÜÐ3¸$Ô?Ð?ñ pùs*   ‚ACÁ,CÁ?&CÂ&CÂ1CÂ2	CÂ<Cc               ó    € V ^8„  d   QhRRRR/# rÌ   r   )r   s   "r   r   r¨     s"   € ÷ ANñ AN°,ð ANÀ3ñ ANr   c              ƒ  óþ  "  € V P                   '       g   V P                  4       # \        P                  ! V P                  VP
                  4      G Rj  x€L
 pV P                  V4      p \        P                  ! VP                  4       P                  4       4      pRT9   pRT9   p\        T4      pT'       g.    T P                  Y#T4      G Rj  x€L
 p	T P                  Y)T4      # T P'                  Y#Y†4      G Rj  x€L
 p\)        T\*        4      '       d   T# Tw  rÈT P-                  Y,Y†T4      G Rj  x€L
 pTe   T# T P.                  P1                  T4      G Rj  x€L
 pTP2                  T8X  d   \        RTR	7      # T P5                  T4       T P.                  P7                  Y<R
R7      G Rj  x€L
 pT'       g   \        R4      # T P9                  TRR7       T P.                  P;                  TR4      G Rj  x€L
  T P=                  T4       T P                   P?                  T4      G Rj  x€L
 ;'       g    Tp T P.                  PA                  T4      G Rj  x€L
 pT'       d4   \G        T Uu. uF  pTPI                  R4      R8X  g   K  TNK  	  up4      M^ pTPJ                  \L        PN                  8X  dV   T'       dN   T'       d   \        T^8X  d   RMRTR7      MRp\        RTTPP                  ;'       g    TPR                  TR7      # T'       g   \        RTR7      # T^8X  d   \        RTTR7      # \        RTTR7      #  ELö  \         d   p\        RTR7      u Rp?# Rp?ii ; i EL¢  \          d.   p
\"        P%                  RT
4       \        RT
R7      u Rp
?
# Rp
?
ii ; i EL´ EL€ ELZ EL	 ELÂ EL‘ ELf  \B         d'    \        RTR7      R,           \E        4       ,           u # i ; iu upi 5i)u@   Handle /resume command â€” list or switch to a previous session.Núgateway.resume.parse_errorr3   rq   rr   z"Failed to list titled sessions: %srÔ  zgateway.resume.already_onrÖ  F)Úpreserve_prompt_pinzgateway.resume.switch_failedÚresumerß   zgateway.resume.resumed_no_countr  rI   rG   rJ   zgateway.resume.msg_count_onezgateway.resume.msg_count_otherr‘   r    z(gateway.resume.matrix_cross_room_success)r  rá  Úmsg_partzgateway.resume.resumed_one)r  r’   zgateway.resume.resumed_many)*rù   r€  r•   r–   Ú!_normalize_source_for_session_keyr·   rÓ   Úshlexrÿ  rø   r‚   r  r   r„   rÐ  Ú_resume_listing_replyr_   rš   rý   rÜ  r`  r   rä  rò   rö   r‹   rí   Úswitch_sessionrð   Úset_model_overriderï   r�  r†  r   r   rƒ   rN   rº   r   r0  râ  r1  )r±   rÍ   r·   r§   rm   r¢   re  rß  r   rÏ  r  Úresolvedr]  ÚdeniedÚcurrent_entryr  r  rP   rR   Ú	msg_countrë  s   &&                   r   Ú_handle_resume_commandÚ2GatewaySessionCommandsMixin._handle_resume_command  sš  é € à××ÐØ×5Ñ5Ó7Ð7Ü×(Ò(¨×)OÑ)OÐQV×Q]ÑQ]Ó^×^ˆØ×2Ñ2°6Ó:ˆð	>Ü—K’K × 6Ñ 6Ó 8× >Ñ >Ó @ÓAˆEð ˜uÑ$ˆ	Ø)¨UÑ2ÐÜ! %Ó(ˆßð@Ø#×9Ñ9¸&ÈyÓY×Y�Ø×1Ñ1°&À)ÓLÐLð
 ×4Ñ4°VÈ$ÓZ×ZˆÜ�h¤×$Ò$ØˆOØ"‰ˆ	Ø×7Ñ7¸È4Ð\lÓm×mˆØÒØˆMØ"×6Ñ6×LÑLÈVÓT×TˆØ×#Ñ# yÔ0ÜÐ0°tÔ<Ð<Ø×)Ñ)¨+Ô6Ø×2Ñ2×AÑAØ¸ð Bó 
÷ 
ˆ	÷ ÜÐ3Ó4Ð4ð
 	×&Ñ& {¸8Ð&ÔDð ×&Ñ&×9Ñ9¸+ÀtÓL×LÐLð 	× Ñ  Ô-Ø×&Ñ&×8Ñ8¸ÓC×C×KÐKÀtˆð	cØ ×4Ñ4×DÑDÀYÓO×OˆG÷ MT”C¡GÓG¡G˜q¨q¯u©u°V«}ÀÑ/FŸ˜¡GÑGÔHÐYZˆ	Ø�?‰?œhŸo™oÔ-×2Bç-6ô ¸9È¼>Ñ7ÐOoØ(õ*Ø<>ð äÐ?ÀuØ ×*Ñ*×<Ð<¨f¯n©nÀxôQð QçÜÐ6¸eÔDÐDØ˜Œ>ÜÐ1¸ÀiÔPÐPÜÐ.°eÀ9ÔMÐMò{ _øô ô 	>ÜÐ1¸Ô=Õ=ûð	>úò Zøäô @Ü—‘ÐAÀ1ÔEÜÐ5¸QÔ?Õ?ûð@úò [ò nò Uò
ò 	Mò DâOøÜ"ô 	cäÐ6¸eÔDÀtÕKÔN`ÓNbÕbÒbð	cüò Hùs]  ‚AO=ÁM	ÁO=Á*2M ÂO=Â:M4 ÃM1ÃM4 Ã%O=Ã;N/Ã<6O=Ä2N2Ä3(O=ÅN5ÅAO=Æ/N8Æ0O=Æ<=O=Ç9N;Ç:3O=È-N>È.
O=È9O=È=O ÉOÉO É O=É(	O=É1O8ÊO8Ê/O=ËO=Ë1O=Ë>O=Ì1O=ÍM.ÍM)Í#M.Í$O=Í)M.Í.O=Í1M4 Í4N,Í?"N'Î!N,Î"O=Î'N,Î,O=Î2O=Î5O=Î8O=Î;O=Î>O=ÏO Ï.O5Ï2O=Ï4O5Ï5O=c               ó$   € V ^8„  d   QhRRRRRR/# )r   rÏ  rÆ  re  rB   r   r   r   )r   s   "r   r   r¨   `  s"   € ÷  ñ  °Jð  È4ð  ÐTWñ  r   c           
     óš  € RpV'       d#   V P                  V4      '       g   \        R4      pV'       gO   VP                  \        P                  8X  d   V'       g   \        R4      # \        R4      pV'       d   V RV 2# T# \        R4      .p\        VR,          ^R7       Fâ  w  rxVR	,          p	VP                  \        P                  8X  di   V'       da   T P                  \        VP                  R
4      ;'       g    R4      4      p
V
'       d&   T	 RV
P                  ;'       g    V
P                   2p	VP                  RR4      R,          pV'       d   \        RVR7      MRpVP                  \        RWyVR7      4       Kä  	  V'       d   VP                  V4       VP                  \        R4      4       RP                  V4      # )z}Numbered /resume list; a non-admin ``--all`` falls back to same-origin scoping and says so
(sibling of the /sessions notice).Nz!gateway.resume.all_requires_adminz'gateway.resume.matrix_no_named_sessionsz gateway.resume.no_named_sessionsrI   zgateway.resume.list_headerrÊ  )Ústartr  rg  r    u    â€” rý  :Né(   Nz"gateway.resume.list_preview_suffix)rý  z!gateway.resume.list_item_numbered)rÕ  r  Úpreview_partz#gateway.resume.list_footer_numbered)rN  r   rº   r   r0  Ú	enumerater)  r   rN   râ  r1  r7   rO   )r±   r·   rÏ  re  Ú
scope_noteÚbaser;   ÚidxrÎ  r  r  rý  rû  s   &&&&         r   rî  Ú1GatewaySessionCommandsMixin._resume_listing_reply`  sg  € ð ˆ
ß˜T×9Ñ9¸&×AÒAÜÐ>Ó?ˆJßØ�‰¤(§/¡/Ô1¿)ÜÐBÓCÐCÜÐ7Ó8ˆDß.8�d�V˜2˜j˜\Ð*ÐB¸dÐBÜÐ/Ó0Ð1ˆÜ  s¥°1×5‰FˆCØ�g•JˆEØ�‰¤(§/¡/Ô1·iØ×<Ñ<¼SÀÇÁÀtÃ×ARÐARÐPRÓ=SÓT�ßØ$˜g U¨6×+;Ñ+;×+MÐ+M¸v¿~¹~Ð*NÐO�EØ—e‘e˜I rÓ*¨3Õ/ˆGßW^œ1ÐAÈ7ÕSÐdfˆLØ�L‰LœÐ>ÀcÐeqÔrÖsñ 6÷ Ø�L‰L˜Ô$Ø�‰”QÐ<Ó=Ô>Ø�y‰y˜ÓÐr   c               ó    € V ^8„  d   QhRRRR/# rÌ   r   )r   s   "r   r   r¨   z  s   € ÷ )Cñ )C°Lð )CÀSñ )Cr   c              ƒ  ó
  "  € V P                   '       g   V P                  4       # ^ RIHpHpHp  V! VP                  4       P                  4       4      w  rVrxTR8X  d   \        R4      # T'       d3   T P                  \        P                  ! TRT 2R7      4      G Rj  x€L
 # \        P                  ! T P                  TP                   4      G Rj  x€L
 p
T P#                  T
4      pT;'       d    T P%                  T
4      pRpT'       d   T'       g   \        R	4      pT P&                  P)                  T
4      G Rj  x€L
 p\        P                  ! T\+        T P                   R
T P                   4      T
P,                  '       d   T
P,                  P.                  MRT'       d   RMTTP0                  RYÆTT'       d   ^2M^
R.R7      G Rj  x€L
 pT'       g6   T Uu. uF)  pT P3                  T
TRR7      G Rj  x€L
 '       g   K'  TNK+  	  ppTR,          pT'       d   \        RTR7      pM\        T'       d   RMR4      pT! YüTTR7      #   \         d   p	\        RT	R7      u Rp	?	# Rp	?	ii ; i ELÓ EL£ EL: L® Lƒu upi 5i)u>   Handle /sessions â€” list previous sessions for gateway chats.)Úformat_gateway_session_listingÚparse_session_listing_argsÚquery_session_listingrè  r3   Nr    zgateway.sessions.usage_searchz/resume )r  z#gateway.sessions.all_requires_adminrX  Tr>  )	r·   r§   Úcurrent_session_idÚinclude_current_sessionÚinclude_all_sourcesÚinclude_unnamedÚsearch_queryrÈ  Úexclude_sourcesF)re  rÊ  zgateway.sessions.title_matching)Úqueryzgateway.sessions.title_allzgateway.sessions.title_named)Úinclude_sourcer  Únotice)rù   r€  Úhermes_cli.session_listingr  r  r  rø   r‚   r  r   rõ  ÚdataclassesÚreplacer•   r–   rì  r·   rÓ   rN  rò   rö   r!   rº   r¿   r‹   ri  )r±   rÍ   r  r  r  Úinclude_allr	  rÚ  r
  r¢   r·   r§   Úcross_originÚscope_noticeró  rž   rj   r  s   &&                r   Ú_handle_sessions_commandÚ4GatewaySessionCommandsMixin._handle_sessions_commandz  s5  é € à××ÐØ×5Ñ5Ó7Ð7÷	_ñ 	_ð	>ÙA[Ø×&Ñ&Ó(×.Ñ.Ó0óB2Ñ>ˆK¨&ð ˜2ÔÜÐ4Ó5Ð5ßØ×4Ñ4´[×5HÒ5HÈÐW_Ð`fÐ_gÐUhÔ5iÓj×jÐjÜ×(Ò(¨×)OÑ)OÐQV×Q]ÑQ]Ó^×^ˆØ×2Ñ2°6Ó:ˆð #×KÐK t×'CÑ'CÀFÓ'KˆØˆßŸ|ÜÐBÓCˆLØ"×6Ñ6×LÑLÈVÓT×TˆÜ×&Ò&Ø!¤7¨4×+;Ñ+;¸UÀD×DTÑDTÓ#UØ,2¯O¯O¨O�6—?‘?×(Ò(Àß ,™°+Ø,×7Ñ7ÐQUØ ,Ø%ç$‘"¨"¸v¸hôH÷ Hˆ÷ Ù#'Óh¡4˜C°×1IÑ1IÈ&ÐRUÐafÐ1IÓ1g×+gÓ+g—C�C¡4ˆDÐhØ�C�yˆßÜÐ7¸|ÔL‰Eä·oÑ2ÐKiÓjˆEÙ-¨dÐW\Ø5AôCð 	Cøô? ô 	>ÜÐ1¸Ô=Õ=ûð	>úò
 kÚ^ò UñHñ ,hùÒhùsË   ‚-J°'I ÁJÁ1-JÂI1Â2JÃI4ÃJÃ0JÄJÄ)JÄ=I7Ä>A%JÆ$'JÇI:ÇJÇJÇI>Ç8I<
Ç9I>ÈI>ÈJÈ.JÉI.ÉI)É#I.É$JÉ)I.É.JÉ4JÉ7JÉ:JÉ<I>É>Jc               ó    € V ^8„  d   QhRRRR/# rÌ   r   )r   s   "r   r   r¨   §  s"   € ÷ ZSñ ZS°,ð ZSÀ3ñ ZSr   c              ƒ  ó>  "  € ^ RI p^ RIp^ RIHp V P                  '       g   V P	                  4       # VP
                  pV P                  V4      pV P                  P                  V4      G Rj  x€L
 p V P                  P                  VP                  4      G Rj  x€L
 pT'       g   \        R4      # TP                  4       P                  R4       RTP!                  4       P"                  R,           2p	\%        TP'                  4       4      w  r«T'       g[   T P                  P)                  TP                  4      G Rj  x€L
 pT P                  P+                  T;'       g    R4      G Rj  x€L
 pTP                  pT
'       d   RMT P-                  Y[4      G Rj  x€L
 pTRJ pT'       d   TpT'       d   TMT P                  T4      pRp\.        P0                  ! \2        4      ;_uu_ 4        T'       d   TP4                  ;'       g    TMTpTP7                  TP9                  4       4      pRRR4        T P                  P;                  T4      G Rj  x€L
 pT P                  P=                  T	TP>                  '       d   TP>                  P@                  MR\C        T PD                  \F        4      '       d6   T PD                  PI                  R	/ 4      ;'       g    / PI                  R
4      MRRT/YÞPJ                  TTPL                  TPN                  TPP                  TTPR                  T;'       g    / PI                  R4      ;'       g    RR7      G Rj  x€L
  \.        P0                  ! \2        4      ;_uu_ 4        T P                  PY                  Y˜ Uu. uF  p\[        T4      NK  	  upRR7      G Rj  x€L
  RRR4       \.        P0                  ! \2        4      ;_uu_ 4        T P                  P]                  Y›4      G Rj  x€L
  RRR4       T'       g$   T P                  P                  T4      G Rj  x€L
  T P                  P_                  TT	4      G Rj  x€L
 pT'       g   \        R4      # T Pa                  T4       T Pc                  T4       \e        T Uu. uF  pTPI                  R4      R8X  g   K  TNK  	  up4      pT'       dS   T^8X  d   RMRp\        TTTYÙR7      pT
'       g/   TP>                  \f        9   d   TR\        R4      ,           ,          pT# T^8X  d   RMRp\        TTTYÙ\i        TP>                  TPP                  4      R7      #  ELò ELÇ  \         d    \        4       u # i ; i EL? EL ELé  + '       g   i     ELc; i ELG ELG  \2         d.   p\T        PW                  RT4       \        RTR7      u Rp?# Rp?ii ; iu upi  EL)  + '       g   i     EL0; i ELò  + '       g   i     ELù; i ELÖ ELµu upi 5i)uU  Handle /branch [--here] [name] â€” fork the current session into an independent copy.

Thread-capable platforms (Discord/Telegram/Slack/Matrix) open a NEW sibling thread bound
to the clone and leave this chat on the original session; ``--here`` (and every platform
without threads) switches the current chat onto the clone instead (#66023).
N)Údatetimezgateway.branch.no_conversationz%Y%m%d_%H%M%Sr™  :Né   NÚbranchrÃ  r6   r  Ú_branched_fromÚsystem_prompt)r‹   r·   r6   Úmodel_configrá   r¾   r§   r1  r6  r/  Úorigin_jsonÚdisplay_namer  z#Failed to create branch session: %szgateway.branch.create_failedr3   iô  )Ú
chunk_rowszgateway.branch.switch_failedrG   rJ   zgateway.branch.branched_onezgateway.branch.branched_many)r  r’   ÚparentÚnewrI   zgateway.branch.thread_fallbackz"gateway.branch.branched_thread_onez#gateway.branch.branched_thread_many)r  r’   r"  r#  Úthread)5ÚjsonÚuuidr  rù   r€  r·   rÓ   rò   rö   r†  r‹   r   r   r   ÚnowÚstrftimeÚuuid4Úhexr   rø   r�  Úget_next_title_in_lineageÚ_branch_open_threadr]   r^   r_   r  ÚdumpsÚto_dictra  rÁ  rº   r¿   r`  rD  r&   rN   r¾   r1  r6  r/  r   rš   r4   Úappend_messages_batchrk   r  rï  Ú&_clear_session_boundary_security_staterï   rƒ   r   r   )r±   rÍ   Ú_jsonÚ_uuidÚ_dtr·   r§   ró  rP   r¼   Ú	stay_hereÚbranch_titleÚcurrent_titlerá   Údest_sourceÚin_placeÚdest_keyÚ_branch_origin_jsonÚ_originr"  r  rd   r  rR   rô  ÚkeyÚreplys   &&                         r   Ú_handle_branch_commandÚ2GatewaySessionCommandsMixin._handle_branch_command§  sÿ  é € ó 	ÛÝ,à××ÐØ×5Ñ5Ó7Ð7Ø—‘ˆØ×2Ñ2°6Ó:ˆØ"×6Ñ6×LÑLÈVÓT×Tˆð	(Ø ×4Ñ4×DÑDÀ]×E]ÑE]Ó^×^ˆG÷ ÜÐ5Ó6Ð6ØŸG™G›I×.Ñ.¨Ó?Ð@ÀÀ%Ç+Á+Ã-×BSÑBSÐTVÕBWÐAXÐYˆÜ"3°E×4JÑ4JÓ4LÓ"MÑˆ	ßØ"&×"2Ñ"2×"DÑ"DÀ]×E]ÑE]Ó"^×^ˆMØ!%×!1Ñ!1×!KÑ!KÈM×LeÐLeÐ]eÓ!f×fˆLØ)×4Ñ4Ð÷ (‘d°4×3KÑ3KÈFÓ3a×-aˆØ $Ð&ˆßØ ˆKß"*‘;°×0LÑ0LÈ[Ó0Yˆð #ÐÜ× Ò ¤×+Õ+ß:B�}×+Ñ+×5Ð5¨vøÈˆGØ"'§+¡+¨g¯o©oÓ.?Ó"@Ð÷ ,ð	>Ø×+Ñ+×7Ñ7Ð8IÓJ×JˆFØ×"Ñ"×1Ñ1Ø)Ø06··°�v—‘×,Ò,ÀYÜMWÐX\×XcÑXcÔei×MjÒMj�t—{‘{—‘ w°Ó3×9Ð9°r×>Ñ>¸yÔIÐptØ.Ð0AÐBØ"3×=PÑ=PØ$¨k×.AÑ.AÈ[×MbÑMbØ%×/Ñ/Ð=PØ*×7Ñ7ÈÏÈÐRT×GYÑGYÐZiÓGj×GrÐGrÐnrð 2ó t÷ tð tô × Ò ¤×+Õ+ð ×"Ñ"×8Ñ8Ø¸WÓ E¹W°c¤¨SÖ!1¹WÑ EÐRUð 9ó W÷ Wð W÷	 ,ô × Ò ¤×+Õ+Ø×"Ñ"×4Ñ4°^ÓR×RÐR÷ ,çð ×*Ñ*×@Ñ@ÀÓM×MÐMØ×2Ñ2×AÑAÀ(ÈNÓ[×[ˆ	ßÜÐ3Ó4Ð4Ø×3Ñ3°HÔ=Ø× Ñ  Ô*Ü¡GÓG¡G˜q¨q¯u©u°V«}ÀÑ/FŸ˜¡GÑGÓHˆ	ßØ3<À´>Ñ/ÐGeˆCÜ�c °YÐGXÔmˆEß §¡Ô4KÔ!KØ˜¤Ð"BÓ CÕCÕC�ØˆLØ6?À1´nÑ2ÐJoˆÜ�˜L°	ÐBSÜ)¨&¯/©/¸;×;PÑ;PÓQôSð 	SòU Uâ^øÜ"ô 	(Ü%Ó'Ò'ð	(úò _Úfò .b÷ ,×+Ð+úò Kòtøô ô 	>Ü�L‰LÐ>ÀÔBÜÐ3¸1Ô=Õ=ûð	>üò !FòW÷	 ,×+Ð+úò S÷ ,×+Ð+úò
 NÚ[ùò
 HùsÌ  ‚A,XÁ.U Á/XÁ4(U& ÂU#ÂU& Â!XÂ)BXÅVÅ!XÅ%
XÅ/VÅ0XÆXÆVÆXÆ/	XÆ97XÇ0V
È$V
È0XÈ9V$ ÉVÉ+V$ ÊAV$ ËAV$ Ì6V$ ÍV$ ÍV!ÍV$ Í"XÎW'ÎWÎ/W'Î;W$Î<W'Ï *XÏ*W>Ð	W;Ð
W>ÐXÐXÐ<XÐ=#XÑ XÑ!XÑ-6XÒ#XÓ XÓXÓBXÕ#U& Õ&U>Õ;XÕ=U>Õ>XÖXÖXÖ
V	Ö	XÖV$ Ö!V$ Ö$WÖ/"W×W×X×W×X×W'×'W8	×2	X×;W>×>X	Ø	
XØXØXc               ó$   € V ^8„  d   QhRRRRRR/# )r   r·   r   r  r   r   r  r   )r   s   "r   r   r¨     s'   € ÷ fñ f°ð fÀcð fÐNeñ fr   c              ƒ  óÂ  "  € \        V4      pV'       d   V P                  V4      MRpVf   R#  VP                  W24      G Rj  x€L
 pT'       g   R# \        TRR4      pTe#   TP                  \        T4      4      G Rj  x€L
  \        Y\        T4      TR7      #  LX  \         d1    \        P                  RTP                  P                  RR7        R# i ; i L[5i)zŒOpen the sibling thread a plain ``/branch`` clones into; the destination source, or
None when this chat cannot host one (in-place fallback).Nz>Branch: create_handoff_thread failed on %s; branching in placeTrä   Ú_threads)Ú	parent_idr/  r  )r   r·  Úcreate_handoff_threadr_   rš   r›   rº   r¿   r!   Ú
mark_asyncr   r   )r±   r·   r  rC  r¼  r/  Úthreadss   &&&    r   r,  Ú/GatewaySessionCommandsMixin._branch_open_thread  sÎ   é € ô )¨Ó0ˆ	ß8A�$×,Ñ,¨VÔ4ÀtˆØŠ?Ùð	Ø%×;Ñ;¸IÓM×MˆI÷
 Ùä˜' :¨tÓ4ˆØÒØ×$Ñ$¤S¨£^Ó4×4Ð4Ü! &ÌÈYËÐ_dÔeÐeñ NøÜô 	Ü�N‰NÐ[Ø!Ÿ?™?×0Ñ0¸4ð ô Aâð	úñ 5ùsL   ‚-C°B ÁBÁB Á	CÁ0CÂCÂCÂB Â7CÃCÃCÃCr   N)F)é   )r    ),Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r´   rÉ   rÚ   r  rú   r)  Ústaticmethodr2  r=  r:  rN  rZ  rb  ri  r�  r„  r‰  rˆ  rØ  r�  r  r
  r  r  r%  rB  rD  r‘  r½  rÃ  rÐ  rÜ  rä  rõ  rî  r  r>  r,  Ú__static_attributes__r   r   r   r¥   r¥   Š   sû   † ñ Bõ*õ,Cõ8õ"H4õTõ.	Mð ôQó ðQõ@õ8^õ
õ 7÷D=õ(TõF0õP	Eõ:*õxXõ&÷0\õAõ>Dõ6õ.9õ21dõf&õPg÷0A(õJ;#õz):õZ	[õõ4@õ ANõF õ4)CõZZS÷xfñ fr   r¥   >   r    rr  ÚdirectÚprivate)rH   Ú
tool_callsÚtool_call_idÚfinish_reasonÚ	reasoningÚreasoning_contentÚreasoning_detailsÚcodex_reasoning_itemsÚcodex_message_itemsÚ	timestampÚdata_use)2rM  Ú
__future__r   r•   r]   r  Úloggingr²  rí  Útypingr   r   Ú
agent.i18nr   Úagent.turn_contextr   Úgateway.configr   Úgateway.platforms.baser   Úgateway.platforms.eventr	   r
   Úgateway.sessionr   r   r   Úgateway.session_transcriptr   Ú$gateway.slash_commands_branch_threadr   r   r   r   r   Úgateway.slash_commands_statusr   Ú	getLoggerrš   r¯   r8  rh   r#   r?   rV   rb   rk   r„   r£   r¥   r   r   r   Ú<module>ri     s£   ðñõ #ã Û Û Û Û 	Û ß "å Ý :Ý #Ý 1ß =ß ZÑ ZÝ :÷õ õ =à	×	Ò	˜=Ó	)€ð  Ð â0€ðIÐ õ
-õ
õ0õ!õõõ[÷.Lfó Lfr   