+
    jHàjwk  ã            
      ób  € R t ^ RIHt ^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	H
t
 ^ RIHtHt ^ RIHt ^ RIHt ^ RIHt ]P(                  ! ]4      t ! R	 R
]4      tR tRR/R ltR!R lt]R!R l4       tR tRRRRRRRR/R ltR tRRRRRRRRRR/R ltRR/R lt R t!R"R lt"R!R lt#R t$R  t%R# )#z—Fresh local routes owned by the authenticated gateway, not by a viewer.

Source and supported launch settings are frozen per route, never process env.
)ÚannotationsN)Úcontextmanager)ÚPlatformÚPlatformConfig)ÚBasePlatformAdapterÚ
SendResult)ÚSessionSource)ÚCANONICAL_GATEWAY_PROTOCOL)ÚRuntimeStoreErrorc                  ó¦   a € ] tR t^tRtV 3R ltR t]R 4       tR t	RR/R lt
R	 tRR
 ltRR/R ltR tRR ltR tR tRV 3R lltR tRtV ;t# )ÚLocalSessionAdapterzHDelivery stays in the canonical event stream; no second local transport.c                	ó€   <€ \         SV `  \        R R7      \        P                  4       Wn        / V n        / V n        R# )T)ÚenabledN)ÚsuperÚ__init__r   r   ÚLOCALÚ	authorityÚsourcesÚpolicies)Úselfr   Ú	__class__s   &&€Ú:/home/ubuntu/.hermes/hermes-agent/gateway/session_local.pyr   ÚLocalSessionAdapter.__init__   s.   ø€ Ü‰Ñœ°Ô5´x·~±~ÔFØ"ŒØˆŒØˆŽó    c                	ó®  a€ V P                   P                  SP                  4      pVf   R# Vw  r4SVJ ;'       d›    V P                  S4      V8H  ;'       d    \        ;QJ dA    V3R lV P
                  P                  P                  4        4       F  '       g   K   R# 	  R# ! V3R lV P
                  P                  P                  4        4       4      # )NFc              3  ó>   <"  € T F  qP                   SJ x € K  	  R # 5i©N©Úsource)Ú.0Úliver   s   & €r   Ú	<genexpr>Ú7LocalSessionAdapter.authorize_source.<locals>.<genexpr>$   s   øé € Ð[Ñ:Z°$Ÿ™ vÕ-Ó:Zùs   ƒT)r   ÚgetÚchat_idÚ	_identityÚanyr   ÚsessionsÚvalues)r   r   ÚsavedÚoriginalÚidentitys   &f   r   Úauthorize_sourceÚ$LocalSessionAdapter.authorize_source   sµ   ø€ Ø—‘× Ñ  §¡Ó0ˆØŠ=ÙØ"ÑˆØ˜(Ð"÷ \ð \ t§~¡~°fÓ'=ÀÑ'I÷ \ð \ß“CÔ[¸$¿.¹.×:QÑ:Q×:XÑ:XÔ:ZÓ[—C”Cð	]Úð	]ØÔ[¸$¿.¹.×:QÑ:Q×:XÑ:XÔ:ZÓ[Ó[ð	]r   c                	ót   € V P                   V P                  V P                  V P                  V P                  3# r   )Úplatformr$   Úuser_idÚprofileÚ	chat_typer   s   &r   r%   ÚLocalSessionAdapter._identity&   s*   € à�‰ §¡°·±ÀÇÁÐPV×P`ÑP`Ð`Ð`r   c                	óX   € WP                  V4      3V P                  VP                  &   R # r   )r%   r   r$   )r   r   s   &&r   Úregister_sourceÚ#LocalSessionAdapter.register_source*   s    € Ø'-¯~©~¸fÓ/EÐ'Eˆ�‰�V—^‘^Ó$r   Úis_reconnectFc             ƒ  	ó   "  € R # 5i)T© )r   r7   s   &$r   ÚconnectÚLocalSessionAdapter.connect-   ó   é € Ùùó   ‚c              ƒ  	óB   "  € V P                   P                  4        R # 5ir   )r   Úclear)r   s   &r   Ú
disconnectÚLocalSessionAdapter.disconnect0   s   é € Ø�‰×ÑÖùs   ‚c              ƒ  	ó^   "  € \        R \        P                  ! 4       P                  R7      # 5i©T)ÚsuccessÚ
message_id©r   ÚuuidÚuuid4Úhex)r   r$   ÚcontentÚreply_toÚmetadatas   &&&&&r   ÚsendÚLocalSessionAdapter.send3   s   é € ä $´4·:²:³<×3CÑ3CÔDÐDùó   ‚+-Úfinalizec             ƒ  	ó$   "  € \        R VR7      # 5irC   )r   )r   r$   rE   rJ   rP   s   &&&&$r   Úedit_messageÚ LocalSessionAdapter.edit_message7   s   é € Ü $°:Ô>Ð>ùs   ‚c              �  	ó   "  € R # 5ir   r9   )r   ÚargsÚkwargss   &*,r   Ú_record_delivery_obligationÚ/LocalSessionAdapter._record_delivery_obligation:   s
   é € ñ ùr=   c              ƒ  	ó   "  € R # 5ir   r9   )r   r$   rL   s   &&&r   Úsend_typingÚLocalSessionAdapter.send_typing?   r<   r=   c              ƒ  	ó   "  € R VRR/# 5i)ÚidÚtypeÚdmr9   )r   r$   s   &&r   Úget_chat_infoÚ!LocalSessionAdapter.get_chat_infoB   s   é € Ø�g˜v tÐ,Ð,ùs   ‚	c              ‹  	ó^   "  € \        R \        P                  ! 4       P                  R7      # 5irC   rF   )r   rV   s   &,r   Úsend_exec_approvalÚ&LocalSessionAdapter.send_exec_approvalE   s    é € ô  $´4·:²:³<×3CÑ3CÔDÐDùrO   c              ƒ  	ó¢   <"  € V P                  V4      pVe   ^ RIHp \        RVRRRRVRV/R7      # \        S	V `  WW4WV4      G R j  x€L
 #  L5i)N)ÚEGRESS_DECLINE_CODEFÚ	forbiddenrD   ÚcodeÚerror)rD   ri   Ú
error_kindÚraw_response)Ú_unanswerable_clarifyÚgateway.relay.egressrf   r   r   Úsend_clarify)
r   r$   ÚquestionÚchoicesÚ
clarify_idÚsession_keyrL   ri   rf   r   s
   &&&&&&&  €r   rn   Ú LocalSessionAdapter.send_clarifyJ   sg   øé € Ø×*Ñ*¨7Ó3ˆØÒõ
 AÜ e°5À[Ø,5°u¸fÐFYÐ[bÐdiÐ+jôlð lô ‘WÑ)¨'¸WÐR]Óh×hÐhÑhùs   ƒAAÁAÁ	Ac                óâ  € V P                   P                  V4      pVf   R# ^ RIHp VP                  R8X  d   R# V! V4      '       d   R# V P
                  P                  P                  V4      pVf   R# VP                  P                  ;_uu_ 4        \        ;QJ d4    R VP                  P                  4        4       F  '       g   K   RM)	  RM%! R VP                  P                  4        4       4      '       d    RRR4       R#  RRR4       ^ R	IHp \        R
 V! V P
                  P                  VR7       4       R4      pVe   RVR,          9   d   R# R#   + '       g   i     L[; i)aé  Why no one can answer a question asked in this chat now, or None to ask it.

Hosted rooms (controls expose approvals only) and forwarded A2A conversations (the
author is a remote peer with no prompt surface) never have an answering viewer. Any
other chat can be answered by an attached viewer holding ``session:respond``; with none
attached, a producer turn (Bot Chat DM, plugin/heartbeat injection) declines, while a
viewer's own turn keeps waiting so its author can re-attach and answer.N)Úis_forward_policyÚbot_roomz,Clarification is unavailable in hosted roomsz0Clarification is unavailable to a forwarded peerc              3  ó@   "  € T F  pR VP                   9   x € K  	  R# 5i)zsession:respondN)Úcapabilities)r   Úmembers   & r   r!   Ú<LocalSessionAdapter._unanswerable_clarify.<locals>.<genexpr>k   s   é € ÐdÑJcÀÐ$¨×(;Ñ(;Ö;ÓJcùs   ‚TF)Úlist_session_admissionsc              3  óF   "  € T F  pVR ,          R8X  g   K  Vx € K  	  R# 5i)ÚstatusÚstartedNr9   )r   Úrows   & r   r!   rz   n   s%   é € ð 7Ñ'e Ø˜x�=¨IÑ5÷ šÓ'eùs   ‚!—
!)Ú
session_idÚlocal_automation_v1Úpayloadz<Clarification is unavailable: no viewer can answer this chat)r   r#   Úgateway.session_a2aru   r   r   r'   Úevent_streamÚlockr&   Úsubscribersr(   Úhermes_state_runtimer{   ÚnextÚdb)r   r$   Úpolicyru   r    r{   r~   s   &&     r   rl   Ú)LocalSessionAdapter._unanswerable_clarifyW   s  € ð —‘×"Ñ" 7Ó+ˆØŠ>ÙÝ9Ø�=‰=˜JÔ&ÙAÙ˜V×$Ò$ÙEØ�~‰~×&Ñ&×*Ñ*¨7Ó3ˆØŠ<ÙØ×Ñ×#×#Ó#ß‹sÑdÈ$×JZÑJZ×JaÑJaÔJcÓd�s�sŠsÑdÈ$×JZÑJZ×JaÑJaÔJcÓd×dÒdØ÷ $Ñ#Ød÷ $õ 	AÜñ 7Ñ'>¸t¿~¹~×?PÑ?PÐ]dÕ'eó 7Ø8<ó>ˆàÒÐ#8¸GÀIÕ<NÔ#NÙQÙ÷ $×#ús   Â5EÃ2EÃ?EÅE.	)r   r   r   ©NNr   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r,   Ústaticmethodr%   r5   r:   r@   rM   rR   rW   rZ   r`   rc   rn   rl   Ú__static_attributes__Ú__classcell__)r   s   @r   r   r      su   ø† ÙRõò]ð ñaó ðaòFð¨Eô òôEð?È5ô ?òô
ò-òE÷
i÷ð r   r   c                ó¼  a€ VP                   \        P                  8w  d   R# ^ RIHp V! V 4      pV P                  VP                  4      P                  \        P                  4      o\        S\        4      '       g   V'       d   R# R# \        ;QJ d    V3R lV 4       F  '       g   K   RM	  RM! V3R lV 4       4      '       g   R# SP                  V4      # )zGNone for legacy/nonlocal routes; registered local adapters fail closed.N)Úall_authoritiesFc              3  ó@   <"  € T F  pSP                   VJ x € K  	  R # 5ir   )r   )r   ÚownerÚadapters   & €r   r!   Ú)authorize_local_source.<locals>.<genexpr>„   s   øé € Ð>±v¨eˆw× Ñ  EÕ)³vùs   ƒT)r/   r   r   Úgateway.session_authoritiesr–   Ú_adapters_for_profiler1   r#   Ú
isinstancer   r&   r,   )Úrunnerr   r–   Úownersr™   s   &&  @r   Úauthorize_local_sourcer    u   sœ   ø€ à‡�œ(Ÿ.™.Ô(Ùõ <Ù˜VÓ$€FØ×*Ñ*¨6¯>©>Ó:×>Ñ>¼x¿~¹~ÓN€GÜ�gÔ2×3Ò3÷ ˆuÐ( DÐ(÷ ‹3Ô>±vÓ>�3�3Š3Ô>±vÓ>×>Ò>ÙØ×#Ñ# FÓ+Ð+r   Úclient_localFc               óú   € ^ RI p^ RIHp ^ RIHp V P                  R4      '       g   \        RRRR7      hVP                  V4      p\        VP                  R4      \        4      '       g   / VR&   V! WVRVR	7      # )
a  Frozen snapshot for --safe-mode / --ignore-user-config: code defaults plus the explicit
launch options. The profile's config.yaml/.env are never read, so a malformed profile cannot
block or shape the session; there is no default model to inherit, so one must be explicit.N)Úbuild_policy)ÚDEFAULT_CONFIGÚmodelÚinvalid_paramsz6a bypass launch has no profile to inherit a model from©ÚfieldÚdetailF)Úprivate_secretsÚprofile_terminalr¡   )
ÚcopyÚgateway.session_policyr£   Úhermes_cli.config_defaultsr¤   r#   r
   Údeepcopyr�   Údict)Úparamsrª   r¡   r¬   r£   r¤   Údefaultss   &$$    r   Ú_bypass_policyr³   ‰   sx   € ó Ý3Ý9Ø�:‰:�g×ÒÜÐ 0¸Ø'_ôað 	aà�}‰}˜^Ó,€HÜ�h—l‘l 7Ó+¬T×2Ò2Øˆ�ÑÙ˜¸/Ð\aØ%1ô3ð 3r   c                ó²   € ^ RI Hp ^ RIHp \	        V 4      ;_uu_ 4        T! V f   RMV! V 4      R,          3!  uuRRR4       #   + '       g   i     R# ; i)aÕ  The profile's effective config.yaml for a NEW session's policy, ``${VAR}`` refs expanded against
the profile's CURRENT ``.env`` (the source tool env refreshes from), not the env this daemon
started with: a single-profile owner binds no secret scope and never reloads ``.env`` for local
turns. A bound scope (a served profile's owner scope) already is that source and is kept; a miss
on the launch profile still falls to the process env (systemd / ``op run`` injection).©ÚPath)Ú_load_gateway_configNzconfig.yamlr9   )Úpathlibr¶   Úgateway.runr·   Úprofile_env_scope)Úhomer¶   r·   s   &  r   Úload_profile_configr¼   š   s>   € õ Ý0Ü	˜4×	 Õ	 Ù#¨DªL¡b¹tÀD»zÈMÕ?YÐ>[Ñ]÷ 
!×	 ×	 Ó	 ús    AÁA	c              #  óè   "  € ^ RI Hp ^ RIHpHpHpHp ^ RIHp V! 4       e   Rx € R# V e	   V! V 4      MV! 4       p V! V! V 4      \        V 4      R7      p Rx € V! V4       R#   T! T4       i ; i5i)zZBind the profile's current ``.env`` (see ``load_profile_config``) unless a scope is bound.rµ   )Úbuild_profile_secret_scopeÚcurrent_secret_scopeÚreset_secret_scopeÚset_secret_scope)Ú_gateway_config_homeN)Úprofile_home)
r¸   r¶   Úagent.secret_scoper¾   r¿   rÀ   rÁ   r¹   rÂ   Ústr)r»   r¶   r¾   r¿   rÀ   rÁ   rÂ   Útokens   &       r   rº   rº   ¦   sf   é € õ ßyÓyÝ0ÙÓÒ)ÛÙØÒ)‰4�Œ:Ñ/CÓ/E€DÙÑ7¸Ó=ÌCÐPTËIÔV€Eð"Ûá˜5Ö!øÑ˜5Õ!üs   ‚AA2ÁA% Á
A2Á%
A/Á/A2c                ó®  € ^ RI Hp ^ RIHp V e#   V P                  '       g   V P                  4       MRpV'       d!   V! V P                  4      R,          R,          MRpV'       d4   V! VP                  R4      4      '       d   VP                  4       '       g   R#  \        VP                  4       4      '       g   R#  RT R2#   \         d     R# i ; i)	z±The plain notice for a session whose client opted into project plugins (its forwarded
``HERMES_ENABLE_PROJECT_PLUGINS``) in a folder that has some: the gateway never loads them.rµ   )Úis_truthy_valueNz.hermesÚpluginsÚHERMES_ENABLE_PROJECT_PLUGINSzproject plugins in zŒ are not loaded: the gateway that runs Hermes sessions does not load ./.hermes/plugins, so HERMES_ENABLE_PROJECT_PLUGINS has no effect here.)r¸   r¶   ÚutilsrÈ   Úclient_env_remoteÚ
client_envÚcwdr#   Úis_dirr&   ÚiterdirÚOSError)rŠ   r¶   rÈ   ÚenvÚfolders   &    r   Úproject_plugins_warningrÔ   ·   s¾   € õ Ý%à!'Ò!3¸F×<T×<TÐ<Tˆ&×
Ñ
Ô
ÐZ^€Cß9<‰T�&—*‘*Ó 	Õ)¨IÖ5À$€Fß‘o c§g¡gÐ.MÓ&N×OÒOÐW]×WdÑWd×WfÒWfÙðÜ�6—>‘>Ó#×$Ò$Ùð %ð " & ð *[ð [ð \øô ô Úðús   ÂC ÃCÃCÚtrusted_policyÚtrusted_secretsÚskills_promptc          
     óÄ   € ^ RI Hp ^ RIHp \	        WW#WEVR7      p	\        V	\        4      '       d/   V! V P                  V P                  V	R7       V! W	R,          4      p	V	# )zGStage, commit and publish a local session inline (synchronous callers).)Úrestore_local_session)Úcommit_local_session)rÕ   rÖ   r×   r¡   )ÚepochÚreceiptr€   )	Úgateway.session_local_recoveryrÙ   Úhermes_state_localrÚ   Ústage_local_sessionr�   r°   r‰   rÛ   )
r   Úactorr±   rÕ   rÖ   r×   r¡   rÙ   rÚ   Ústageds
   &&&$$$$   r   Úcreate_local_sessionrâ   Ê   sV   € õ EÝ7Ü  °6Ø1@Ø.:ô<€Fô �&œ$×ÒÙ˜YŸ\™\°·±È&ÕQÙ& y¸Õ2FÓGˆØ€Mr   c                óÚ  € \        V\        4      '       d	   V'       g   R# ^ RIHp ^ RIHp V! V P                  VP                  V4      pV P                  P                  V4      f   R#  \        P                  ! V! V P                  V4      R,          R,          4      p\        T\         4      ;'       d    TP#                  R4      RJ #   \        \        \        \        3 d     R# i ; i)a‹  Whether a retry of *request_id* may ask to follow the profile.

True when nothing is staged under that identity, or the staged request already follows.
False only when an older build committed the session without ``follow_profile_config`` and
stopped before its title. The next attempt reuses the identity, and a different request is
refused for good. The retry then carries the frozen request.
T)Úlocal_identity©Úlocal_receiptrŠ   Úrequest_jsonÚfollow_profile_config)r�   rÅ   rÝ   rä   rÞ   ræ   Ú
profile_idÚsubjectr‰   Úget_sessionÚjsonÚloadsÚKeyErrorÚ	TypeErrorÚ
ValueErrorr
   r°   r#   )r   rà   Ú
request_idrä   ræ   ÚsidÚrequests   &&&    r   Ústaged_creation_followsrô   Ø   s¹   € ô �j¤#×&Ò&¯jÙÝ=Ý0Ù
˜×-Ñ-¨u¯}©}¸jÓ
I€CØ‡|�|×Ñ Ó$Ò,ÙðÜ—*’*™]¨9¯<©<¸Ó=¸hÕGÈÕWÓXˆô �gœtÓ$×UÐU¨¯©Ð5LÓ)MÐQUÐ)UÐUøô ”i¤Ô->Ð?ô Úðús   Á+5C ÃC*Ã)C*Údesktop_localc               ó  aa3€ VP                   V P                   8w  d   \        R4      hRVP                  9  d   \        R4      h^ RIHpHp	Hp
Hp ^ RIH	p ^ RI
Hp \        T;'       g    / 4      pSP                  R4      pVe   TpEM·\        ;QJ d    V3R	 lV	 4       F  '       g   K   R
M	  RM! V3R	 lV	 4       4      '       d   \        SWæR7      pEMh^ RIHp SP                  R4      Supo3\%        4       ;_uu_ 4        \'        4       pV! SV4      oRRR4       V! SXVR
VR7      pSS3JdY   ^ RIp\+        VV33R lR7 4       4      pV! VVP,                  ! / VP.                  ! VP0                  4      CRVRV/CR
R7      R7      pV'       d   VP2                  R8X  d   VR
/M/ pVP4                  fE   ^ RIHp T! TV! VP;                  4       4      ;'       g    RR7      pVP4                  V8X  d   R
VV
&   V'       d=   ^ RIpV! VVP,                  ! / VP.                  ! VP<                  4      CVC4      R7      pSP                  R\>        P@                  ! 4       PB                  4      p\E        V\F        4      '       d   V'       d   \I        V4      R8”  d   \        RRRR7      h^ RI
H%p ^ RI&H'p ^ R I(H)p ^ R!I*H+pH,p V P[                  4        V! V P                   VP\                  V4      p^ R"IH/pH0p H1p! V Pd                  Pg                  V4      Ee
   ^ R#I4H5p" V"! V Pd                  V4      p#V ! V#R$,          4      p$^ R%I4H6p% V%! V#R$,          VP0                  S4      '       g   \        RRR&R7      h^ RI7p&^ RIpRVP.                  ! V$P0                  4      9   d   Ve   \        R'4      hMjV$Pp                  f   SP                  R4      eJ   V!! V V$4      p'V'e2   T&Ps                  T'SP                  R4      ;'       g    R(4      '       g   \        R'4      hV! V V4      # ^ R)IH:p( V(! S4      '       d   Vf   \        RR*R+R7      hV! VVR,7      p\w        V4      ;p)'       d   \x        P{                  R-VV)4       R8 U*u/ uF  p*V*S9   g   K  V*SV*,          bK  	  p+p*V! V VVSP                  R4      VVRJ V+R.7      p^ R/I*H>p, V,! V VVP\                  4      p-V P~                  P€                  Pƒ                  V-4      p.V! 4       p/V! V.VV/V/V-\„        P†                  R07      p0^ R1IDHEp1 V1! V VR2V P                   R3VP\                  RVR4VR5V.R6V0P�                  4       R$V! V4      /4      p2V+V2nG        V2#   + '       g   i     ELb; iu up*i )9a?  Everything before the creation commit: the existing session's ref on an exact retry, else the
receipt ``commit_local_session`` writes (the async RPC commits it off the owner loop).
``client_local``: the gateway's own proof that the client is on this host (its connection redeemed a
ticket minted over the private control socket), never a value the client sends. ``desktop_local``:
that client is also the Desktop app (``process_identity.local_desktop_client``); a Desktop chat
records it so its turns run as work for the local Desktop (``session_policy.local_desktop_turn``).Úprofile_mismatchzsession:createÚpermission_denied)r£   ÚBYPASS_FIELDSÚFOLLOW_ADOPTEDÚLOCAL_DESKTOP_CHAT)Ú_resolve_gateway_model)ÚreplaceÚapi_keyNc              3  óJ   <"  € T F  pSP                  V4      R J x € K  	  R# 5i)TN)r#   )r   Únamer±   s   & €r   r!   Ú&stage_local_session.<locals>.<genexpr>  s   øé € Ð@±-¨$ˆV�Z‰Z˜Ó Õ%³-ùs   ƒ #TF)rª   r¡   )Úresolve_launch_router¥   )rª   Úworkspace_posturer¡   c              3  óJ   <"  € T F  qS9   g   K  VS9  g   K  Vx € K  	  R # 5ir   r9   )r   Úkeyr±   Úsents   & €€r   r!   r    s$   øé € ÐjÑ,D SÈvÉœSÐZ]ÐeiÑZiŸSšSÓ,Dùs   ƒ#�#™
#Úmodel_requestedÚroute_derived)Ú	sort_keys)rç   Úgui)ÚGUEST_MODEL)r¥   )Úconfig_jsonrñ   é   r¦   z4must be a non-empty string of at most 256 charactersr§   )Úasdict)ÚSessionEntry)Ú_now)rä   rÙ   )Úbind_launch_keyÚrestore_policyÚ
launch_keyrå   rŠ   )Úsame_create_retryz7a resumed request_id must carry the same frozen requestÚadmission_conflictÚ )Úlaunch_skillsÚskillsz;the caller must render -s skills before minting the session)r×   zsession %s: %s)Úconfig_secretsÚ	owner_keyÚclient_request)Úlocal_source)Úoriginr/   )Ústage_session_prefillré   Úprincipal_idr€   ÚrouteÚentry)ÚproviderÚbase_url)rÍ   )Hré   r
   rx   r­   r£   rù   rú   rû   r¹   rü   Údataclassesrý   r°   r#   r&   r³   Úgateway.session_local_router  rº   r¼   rì   ÚsortedÚdumpsrí   rç   r   r¥   Úhermes_cli.anon_authr  Úconfigr  rG   rH   rI   r�   rÅ   Úlenr  Úgateway.sessionr  Úgateway.session_lifecycler  rÝ   rä   rÙ   Ú_require_admission_openrê   r  r  r  r‰   rë   rÞ   ræ   r  ÚhmacÚcredential_refÚcompare_digestr  rÔ   ÚloggerÚwarningr  rž   Úsession_storeÚ_generate_session_keyr   r   Ú gateway.session_worker_constructr  Úto_dictr  )4r   rà   r±   rÕ   rÖ   r×   r¡   rõ   r£   rù   rú   rû   rü   rý   rª   Ú
client_keyrŠ   r  Ú	raw_modelr)  rì   ÚderivedÚmarksr  rñ   r  r  r  rä   rÙ   rò   r  r  r  ræ   r)   r*   r  r.  r  r  r2  Úkr  r  r   r   Únowr!  r  rá   r  s4   &&f$$$$$                                           @r   rß   rß   î   sÛ  ù€ ð ×Ñ˜9×/Ñ/Ô/ÜÐ 2Ó3Ð3Ø˜u×1Ñ1Ô1ÜÐ 3Ó4Ð4ßfÓfÝ2Ý#Ü˜?×0Ð0¨bÓ1€OØ—‘˜IÓ&€JØÒ!ØŠß	‹Ô@±-Ó@��ŠÔ@±-Ó@×	@Ò	@Ü ¸ÔcŠåDØ Ÿ*™* WÓ-¨vˆˆ	�4Ü× Õ Ü(Ó*ˆFÙ)¨&°&Ó9ˆF÷ !ñ ˜f f¸oÐaeØ+7ô9ˆà˜Óó ÜÕjÑ,DÓjÓjˆGÙ˜V°$·*²*Øk�4—:’:˜f×1Ñ1Ó2ÐkÐ4EÀyÐRaÐcjÑkØô3 ô !ˆF÷ /<ÀÇÁÐQVÔ@VÐ# TÑ*Ð\^ˆØ�<‰<ÒÝ8Ù˜VÑ+AÀ&Ç-Á-Ã/Ó+R×+ZÐ+ZÐVZÔ[ˆFØ�|‰|˜{Ô*à(,��nÑ%ßÛÙ˜V°·²Ð<g¸t¿zºzÈ&×J\ÑJ\Ó?]Ð<gÐafÐ<gÓ1hÔiˆFØ—‘˜L¬$¯*ª*«,×*:Ñ*:Ó;€JÜ�j¤#×&Ò&¯j¼CÀ
»OÈcÔ<QÜÐ 0¸Ø']ô_ð 	_å"Ý,Ý.ßTØ×%Ñ%Ô'Ù
˜×-Ñ-¨u¯}©}¸jÓ
I€CßRÑRØ‡|�|×Ñ Ó$Ó0Ý4Ù˜iŸl™l¨CÓ0ˆÙ! %¨¥/Ó2ˆÝ8Ù   x¥°&×2EÑ2EÀv×NÒNÜ#Ð$4¸LØ+dôfð fãÛØ §
¢
¨8×+@Ñ+@Ó AÔAð Ò%Ü'Ð(<Ó=Ð=ð &à×$Ñ$Ò0°F·J±J¸yÓ4IÒ4UÙ˜Y¨Ó1ˆCØŠ{ $×"5Ñ"5°c¸6¿:¹:ÀiÓ;P×;VÐ;VÐTV×"WÒ"WÜ'Ð(<Ó=Ð=Ù$ Y°Ó4Ð4Ý4Ù�V×Ò Ò!6ô  Ð 0¸Ø'dôfð 	fá�V¨=Ô9€FÜ)¨&Ó1Ð1€wÖ1Ü�‰Ð'¨¨gÔ6Ù,;ÓK©O q¸qÀF¹{”l�a˜ �’l©O€NÐKÙ˜Y¨¨V°V·Z±ZÀ	Ó5JÐ[jØ'1°TÐ'9Ø,:ô<€Fõ <Ù˜) S¨%¯-©-Ó8€FØ×Ñ×*Ñ*×@Ñ@ÀÓH€Eñ ‹&€CÙ˜  S¨#°fÄxÇ~Á~ÔV€EåFÙ" 9¨fØ�i×*Ñ*¨N¸E¿M¹MÈ<ÐYcØ�c˜7 E¨7°E·M±M³OÀXÉvÐV\Ë~ð7_ó `€Fð
 +€FÔØ€M÷i !× Ð üòB Ls   ÄU3Ò	VÒVÕ3V	ÚevictTc               ój  € ^ RI Hp ^ RIHp V P                  V,          p^ RIHp V! V 4      \        P                  ,          pV! V! V P                  V4      R,          4      VP                  VP                  P                  &   V'       d(   V P                  P                  VP                  4       R# R# )é    rå   )r  )Úlocal_adapter_maprŠ   N)rÞ   ræ   r­   r  r'   rÝ   r@  r   r   r‰   r   r   r$   rž   Ú_evict_cached_agentr   )r   r€   r=  ræ   r  r    r@  r™   s   &&$     r   Úpublish_local_policyrB  ]  s   € Ý0Ý5Ø×Ñ˜jÕ)€DÝ@Ù 	Ó*¬8¯>©>Õ:€GÙ,:¹=ÈÏÉÐWaÓ;bÐckÕ;lÓ,m€G×Ñ�T—[‘[×(Ñ(Ñ)ßØ×Ñ×,Ñ,¨T¯Z©ZÖ8ñ r   c                óÊ  € ^ RI pV'       d   VP                  V 4      MRpVer   VP                  ! VP                  4      P	                  R4      '       gA   \        VP                  ;'       g    R4      P                  4       P                  4       R9  d   V# ^ RI	H
p ^ RIHpHp V! V 4      ;_uu_ 4        V! 4       '       d   TMTuuRRR4       #   + '       g   i     R# ; i)z¶The model a not-yet-built session will run: with no provider pinned, the free tier's agent
build pins ``nous/welcome`` (``pin_model_for_route``), so the configured default is not it.Nr¥   r  )Úowner_scope)r  Úfree_tier_route>   r  Úauto)rì   Úcurrent_modelrí   rç   r#   rÅ   r"  ÚstripÚlowerr›   rD  r(  r  rE  )r   rŠ   rì   r¥   rD  r  rE  s   &&     r   Ú_lazy_modelrJ  h  sœ   € ó ß/5ˆF× Ñ  Ô+¸4€EØŠ˜$Ÿ*š* V×%8Ñ%8Ó9×=Ñ=¸g×FÒFÜ�6—?‘?×(Ð( bÓ)×/Ñ/Ó1×7Ñ7Ó9ÀÔMØˆÝ7ßAÙ	�Y×	Õ	Ù-×/Ò/‰{°U÷ 
 ×	×	Ó	ús   Â5CÃC"	c                ób  € ^ RI Hp ^ RIHp V f   Vf   / # V e	   V! V 4      MRpVf7   ^ RIHp VP                  VRR7      w  ršV	P                  R4      ;'       g    / pVe   \        VRR4      MVe   TMX! X	X
;'       g    R	4      pVe   \        VR
R4      M/T! X	P                  R4      ;'       g    / P                  R
4      4      ;'       g    R	pVe   \        VRR4      MXP                  R4      pVe   \        VRR4      MXP                  R4      p\        WÍW.V\        VRR4      4      # )zñMain's session-info effort/tier fields, from the built agent or (lazy) what the policy's next turn
resolves (a following session's current profile): a resumed Desktop slice holds its reasoning pill
pending until ``reasoning_effort`` arrives.)Úparse_service_tier)Úsession_runtime_viewN)Úresolve_reasoning_configF©Úsecretsr¥   Úreasoning_configr  Úservice_tierÚagentr"  r#  Úapi_mode)
Úagent.fast_moderL  Úagent.voice_turn_routerM  Úhermes_constantsrN  Ú	effectiver#   ÚgetattrÚeffort_fields)rS  rŠ   r¥   r   ÚoverriderL  rM  ÚviewrN  rX  Ú
next_modelr   r)  Útierr"  r#  s   &&&&&           r   Ú_reasoning_fieldsr_  v  s7  € õ 3Ý;Ø‚}˜šØˆ	Ø*/Ò*;Ñ Ô&À€DØ‚|Ý=Ø &× 0Ñ 0°ÀEÐ 0Ó JÑˆ	Ø—‘˜gÓ&×,Ð,¨"ˆØ9=Ò9IŒg�dÐ.°Ô5Ø'Ò3‘8Ñ9QÐR[Ð]g×]mÐ]mÐkmÓ9nð à37Ò3CŒG�D˜.¨$Ô/Ù# Y§]¡]°7Ó%;×%AÐ%A¸r×$FÑ$FÀ~Ó$VÓW÷_ð _Ø\^ð 	à26Ò2BŒw�t˜Z¨Ô.ÈÏ	É	ÐR\ÓH]€HØ26Ò2BŒw�t˜Z¨Ô.ÈÏ	É	ÐR\ÓH]€HÜ˜ u¸Ä'È$ÐPZÐ\`ÓBaÓbÐbr   c           
     óä  € ^ RI Hp ^ RIHpHp ^ RIHp	 T;'       g    RpRp
\        V \        4      '       d<   V P                  R4      RJ d   RM#\        V P                  R4      ;'       g    R4      p
RpV
'       d*   V
R8w  d#   \        V! W¨! W2V4      4      ;'       g    R4      p W9   ;'       d"    T	! Y#;'       g    R	T;'       g    R	VR
7      R	JpRV
RVRVRV/#   \         d    Rp Li ; i)zcSession-info ``reasoning_effort`` / ``_wire`` / ``service_tier`` / ``fast`` for one resolved route.)ÚSTATIC_TIERS)Úclamp_effortÚroute_supported_efforts)Úresolve_fast_mode_overridesr  r   FÚnoneÚeffortN)r"  r#  r^  Úreasoning_effortÚreasoning_effort_wirerR  Úfast)rU  ra  Úagent.reasoning_effortrb  rc  Úhermes_cli.modelsrd  r�   r°   r#   rÅ   Ú	Exception)r)  r^  r¥   r"  r#  rT  ra  rb  rc  rd  rf  Úwireri  s   &&&&&&       r   rZ  rZ  Œ  sý   € å,ßLÝ=Ø�:ˆ:�2€DØ€FÜ�&œ$×ÒØ!Ÿ:™: iÓ0°EÓ9‘¼sÀ6Ç:Á:ÈhÓCW×C]ÐC]Ð[]Ó?^ˆØ€Dß�&˜FÔ"Ü‘< Ð(?ÀÐQYÓ(ZÓ[×aÐaÐ_aÓbˆðØÑ#÷ `ð `Ñ(CØ×,Ð,¨°x×7GÐ7GÀ4Èdô)TØ[_ð)`ˆð  Ð(?ÀÀ~ÐW[Ð]cÐeiÐjÐjøô ô ØŠðús$   Â(
C Â3C Â?
C Ã
C ÃC/Ã.C/c                ó  € V P                   VP                  ,          pV P                  V4      p^ RIHp ^ RIHp V! V P                  VP                  4      pRV'       d   VP                  MVP                  P                  P                  RVe'   \        TRV'       d   VP                  V 4      MR4      M
\        W4      RVRJ RV P                  R\        R	V! V P                  4      /V'       d   R
VP                   /M/ CV'       d    VP                  R8X  d   RVP"                  /M/ Cp\        V P                  RR4      pVe   V! VP$                  4      MRp	V	e   V	P&                  P(                  MRp
VfW   VfS   VP                  P                  \*        P,                  8w  d*   ^ RIHp VP3                  V! V P                  V4      4       M#VP3                  \5        W6VR,          W
4      4       V'       dr   ^ RIpVP8                  ! VP:                  4      VR&   ^ RIHp \A        V4      VPB                  '       d   TMR3pRPE                  \G        RV4      4      ;p'       d   W÷R&   VP3                  \I        WW#V4      4       V# )r?  )Úserved_profile_name)Úpolicy_for_sourcer   r¥   NÚlazyré   Údesktop_protocolÚprofile_namerÎ   ÚacpÚedit_approval_policyÚ_peek_session_state)Úmessaging_route_infoÚlaunch_request)ÚNOT_LOCAL_WARNINGÚ Úconfig_warning)%r'   r€   rS  r›   ro  r­   rp  rž   r   r/   ÚvaluerY  rG  rJ  ré   r	   rÎ   ru  r   ÚconversationÚreasoning_overrider   r   Úgateway.session_messaging_picksrw  Úupdater_  rì   rí   rç   Úagent.session_client_envry  rÔ   rÌ   ÚjoinÚfilterÚ_classic_cli_fields)r   Úrefr    rS  ro  rp  rŠ   ÚinfoÚpeekÚstater[  rw  rì   ry  Únoticesr2  s   &&              r   Úlocal_session_inforŠ     s   € Ø×Ñ˜cŸn™nÕ-€DØ�O‰O˜CÓ €EÝ?Ý8Ù˜y×/Ñ/°·±Ó=€FØ§v�f—m’m°4·;±;×3GÑ3G×3MÑ3MØÐfkÒfw”g˜e W×QW¨f×.BÑ.BÀ9Ô.MÐ]aÔbÜ& yÓ9Ø�E˜T�MØ˜)×.Ñ.Ð0BÔD^àÑ/°	×0DÑ0DÓEð	t÷ '-��v—z‘zÑ"°"ð	t÷ IOÐSY×S`ÑS`ÐdiÔSiÐ&¨×(CÑ(CÑDÐoqð	t€Dô �9×#Ñ#Ð%:¸DÓA€DØ $Ò 0‰D�—‘Ô°d€EØ8=Ò8Iˆu×!Ñ!×4Ò4Èt€HØ‚}˜š¨D¯K©K×,@Ñ,@ÄHÇNÁNÔ,Rõ 	IØ�‰Ñ(¨×)9Ñ)9¸4Ó@ÕAà�‰Ô% e°T¸'µ]ÀIÓXÔYßó 	Ø!%§¢¨F×,?Ñ,?Ó!@ˆÐÑÝ>ä*¨6Ó2È×Ia×IaÐIaÑ4EÐgkÐlˆØ—h‘hœv d¨GÓ4Ó5Ð5ˆ7Ö5Ø%,Ð!Ñ"Ø‡K�KÔ# I°DÀÓHÔIØ€Kr   c                ó€  € ^ RI pVP                  pVP                  \        4      ;_uu_ 4        ^ RIHp V! V P                  VP                  4      R,          R,          ;'       g    TpRRR4       / pVP                  \        4      ;_uu_ 4        V P                  P                  V4      ;'       g    / pRRR4       \        VRJ;'       d    \        VRR4      4      p	VP                  \        4      ;_uu_ 4        ^ RI
Hp
 T	;'       g    V
! VP                  4      p	RRR4       Ve   \        VRR4      MRpVfm   Vei   VP                  \        4      ;_uu_ 4        VP                  V RR	7      ^ ,          P                  R
4      ;'       g    / P                  R4      pRRR4       RpVe5   \        VRR4      '       d"   ^ RIHp V! \#        VP$                  4      4      pVe   \        VRR4      MRpVP                  R4      pRVP                  R4      RTRVP                  R4      ;'       g    TRT	RT;'       g    RR\'        V\(        4      '       d   \+        V4      RV/# RRV/#   + '       g   i     EL; i  + '       g   i     ELÖ; i  + '       g   i     EL€; i  + '       g   i     EL; i)a  What main's HermesCLI read off itself for /status, the status bar and the exit summary: the
stored title and times, the session's yolo, api_mode, the loaded tool count and a masked
credential hint (never the key). Lazy sessions report what is known without building an agent.Nrå   r!  r€   ÚyoloF)Úis_session_yolo_enabledrT  rO  r¥   rþ   )Úmask_secretÚtoolsÚ
started_atÚtitleÚlast_active_atÚlast_activity_atÚ
tool_countÚcredential_hint)Ú
contextlibr€   Úsuppressrl  rÞ   ræ   r‰   rë   ÚboolrY  Útools.approvalr�  r   rX  r#   Úagent.redactrŽ  rÅ   rþ   r�   Úlistr*  )r   r…  r    rS  rŠ   r–  Ú	stored_idræ   r   rŒ  r�  rT  ÚhintrŽ  r�  r~   s   &&&&&           r   r„  r„  È  s>  € ó Ø—‘€IØ	×	Ñ	œY×	'Õ	'Ý4Ù! )§,¡,°·±Ó?ÀÕHÈÕV×cÐcÐZcˆ	÷ 
(ð €CØ	×	Ñ	œY×	'Õ	'Ø�l‰l×&Ñ& yÓ1×7Ð7°Rˆ÷ 
(ä�˜dÐ"×EÐE¤w¨v°v¸uÓ'EÓF€DØ	×	Ñ	œY×	'Õ	'Ý:Ø×:Ð:Ñ.¨t¯z©zÓ:ˆ÷ 
(ð 49Ò3DŒw�u˜j¨$Ô/È$€HØÒ˜FÒ.Ø× Ñ ¤×+Õ+Ø×(Ñ(¨¸EÐ(ÓBÀ1ÕE×IÑIÈ'ÓR×XÐXÐVX×]Ñ]Ð^hÓiˆH÷ ,à€DØÒœW U¨I°t×<Ò<Ý,Ùœ3˜uŸ}™}Ó-Ó.ˆØ-2Ò->ŒG�E˜7 DÔ)ÀD€EØ�g‰g�lÓ#€GØ�S—W‘W˜WÓ% |°WØ˜cŸg™gÐ&8Ó9×DÐD¸WÀfÈdØ˜×(Ð( D¨,ÄjÐQVÔX\×F]ÒF]¼¸E»
Ø˜tð%ð %àcgØ˜tð%ð %÷) 
(×	'Ð	'ú÷ 
(×	'Ð	'ú÷ 
(×	'Ð	'ú÷
 ,×+Ð+ús0   ®<I0Â&JÃ>#JÅ!AJ,É0J	ÊJ	ÊJ)	Ê,J=	r   rŒ   )&r‘   Ú
__future__r   rì   ÚloggingrG   r–  r   Úgateway.configr   r   Úgateway.platforms.baser   r   r+  r   Úgateway.session_contractr	   r‡   r
   Ú	getLoggerr�   r1  r   r    r³   r¼   rº   rÔ   râ   rô   rß   rB  rJ  r_  rZ  rŠ  r„  r9   r   r   Ú<module>r¤     s   ðñõ #ã Û Û Ý %ç 3ß BÝ )Ý ?Ý 2à	×	Ò	˜8Ó	$€ô]Ð-ô ]ò@,ð(3¸Eô 3ô"	^ð ó"ó ð"ò \ð&ÀTð Ð[_ð Ðosð Ø&+ôòVð,lÀDð lÐZ^ð lÐnrð lØ%*ðlØ:?ôlð^9¸ô 9ò;ôcô,kò(%ôP%r   