+
    lHàjÖ  ã                  óP  € R t ^ RIHt ^ RIt^ RIt^ RIHt ^ RIHtH	t	 ]P                  ! ]4      t. R(OtRtRtRtR	tR
RRRRR/t]! R04      t]! RR7       ! R R4      4       tR R ltR R ltR R ltR R ltR R ltR)R R lltR)R R  lltR! R" ltR#RR$RR%R/R& R' lltR# )*as  Caller identity for requests to the first-party gateways: who is calling, and which turn asked.

``user_agent()`` goes on every request. The correlation headers name the conversation, turn and tool
call, so they go only to connector routes and only when the profile has opted in to sending
telemetry. The gateway strips every ``x-nous-`` header before it calls a vendor.
)ÚannotationsN)Ú	dataclass)ÚMappingÚOptionalÚCallRefzx-nous-hermes-sessionzx-nous-hermes-turnzx-nous-hermes-tool-callzx-request-idÚdarwinÚmacosÚlinuxÚwin32ÚwindowsÚconnection_not_foundT)Úfrozenc                  ó8   € ] tR t^'t$ RtRtR]R&   RtR]R&   RtR# )r   zJThe model's ids for the call a request serves. Absent fields are not sent.NúOptional[str]Úturn_idÚtool_call_id© )	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__annotations__r   Ú__static_attributes__r   ó    ÚC/home/ubuntu/.hermes/hermes-agent/tools/managed_gateway_identity.pyr   r   '   s   ‡ áTà!€Gˆ]Ó!Ø"&€L�-×&r   c               ó   € V ^8„  d   QhRR/# ©é   ÚreturnÚstrr   )Úformats   "r   Ú__annotate__r"   /   s   € ÷ \ñ \˜ñ \r   c                 ó   € ^ RI Hp  ^ RIHp ^ RIHp ^ RIHp V ! 4       pVe3   VP                  P                  '       d   VP                  P                  # V! 4       ;p'       d   V# V! V! RR4      4      '       d   R# R# )	zþThe session's platform: the running turn's agent platform, else the bound session vars.

Off a turn (a desktop page action, an account operation thread) only the session vars exist.
The classic CLI and one-shot runs bind neither, so they read as ``cli``.)Úcurrent_turn©Úget_session_env)Úsession_platform)Úis_truthy_valueÚHERMES_CRON_SESSIONÚ ÚcronÚcli)
Úagent.relay_runtimer$   Úgateway.session_contextr&   Útools.connectors.gateway.configr'   Úutilsr(   ÚleaseÚplatform)r$   r&   r'   r(   Úturnr2   s         r   Ú_platform_namer4   /   sm   € õ
 1Ý7Ý@Ý%á‹>€DØÒ˜DŸJ™J×/×/Ð/Ø�z‰z×"Ñ"Ð"Ù#Ó%Ð%€xÖ%ØˆÙ$¡_Ð5JÈBÓ%O×PÒPˆ6Ð[ÐV[Ð[r   c               ó   € V ^8„  d   QhRR/# r   r   )r!   s   "r   r"   r"   A   s   € ÷ 8ñ 8˜ñ 8r   c                 óH   € ^ RI Hp  V ! R\        4       /4      pVR8X  d   R# T# )é    )Úexecution_surfacer8   ÚunknownÚother)Ú0hermes_cli.observability.shared_metrics_contractr8   r4   )r8   Úsurfaces     r   Úrequest_surfacer=   A   s*   € ÝRáÐ!4´nÓ6FÐ GÓH€GØ Ô*ˆ7Ð7°Ð7r   c               ó   € V ^8„  d   QhRR/# r   r   )r!   s   "r   r"   r"   H   s   € ÷ ^ñ ^�Cñ ^r   c                 ó–   € ^ RI Hp  ^ RIHp \        P                  V! 4       R4      pRV ! 4       P                   R\        4        RV R2# )r7   )Úget_version_info)Ú	os_familyr9   zhermes-agent/z (z; Ú))Úhermes_cli.version_infor@   Úhermes_platform.host.factsrA   Ú
_OS_FAMILYÚgetÚbase_versionr=   )r@   rA   Úos_names      r   Ú
user_agentrI   H   sH   € Ý8Ý4ä�n‰n™Y›[¨)Ó4€GØÑ+Ó-×:Ñ:Ð;¸2¼oÓ>OÐ=PÐPRÐSZÐR[Ð[\Ð]Ð]r   c               ó   € V ^8„  d   QhRR/# )r   r   Úboolr   )r!   s   "r   r"   r"   P   s   € ÷ Nñ N˜ñ Nr   c                 ó`   € ^ RI Hp  ^ RIHp T! V ! 4       ;'       g    / 4      P                  RJ # )r7   )Úread_raw_config_readonly)Úresolve_send_configT)Úhermes_cli.configrM   Ú3hermes_cli.observability.shared_metrics_send_configrN   Úsend)rM   rN   s     r   Ú_send_consentedrR   P   s*   € Ý:ÝWáÑ7Ó9×?Ð?¸RÓ@×EÑEÈÐMÐMr   c               ó   € V ^8„  d   QhRR/# )r   r   r   r   )r!   s   "r   r"   r"   W   s   € ÷ Zñ Z˜-ñ Zr   c                 ó^   € ^ RI Hp  ^ RIHp V ! 4       ;'       g    V! RR4      ;'       g    R# )r7   )Úget_conversation_contextr%   ÚHERMES_SESSION_IDr*   N)Úagent.portal_tagsrU   r.   r&   )rU   r&   s     r   Ú_conversation_idrX   W   s*   € Ý:Ý7á#Ó%×YÐY©Ð9LÈbÓ)Q×YÐYÐUYÐYr   c               ó    € V ^8„  d   QhRRRR/# ©r   ÚcallúOptional[CallRef]r   zdict[str, str]r   )r!   s   "r   r"   r"   ^   s   € ÷ ñ Ð/ð ¸>ñ r   c           
     ó”  € \        4       '       g   / # \        \        \        P                  ! 4       4      /p\
        \        4       \        V '       d   V P                  MR\        V '       d   V P                  MR/pTP                  VP                  4        UUu/ uF  w  r4V'       g   K  V\        V4      bK  	  upp4       V# u uppi )z™``x-request-id`` (fresh per HTTP attempt) and the conversation, turn and tool call ids, or
``{}`` when the profile has not opted in to sending telemetry.N)rR   ÚREQUEST_ID_HEADERr    ÚuuidÚuuid4ÚSESSION_HEADERrX   ÚTURN_HEADERr   ÚTOOL_CALL_HEADERr   ÚupdateÚitems)r[   ÚheadersÚidsÚnameÚvalues   &    r   Úcorrelation_headersrj   ^   s‘   € ô ×ÒØˆ	Ü ¤#¤d§j¢j£lÓ"3Ð4€GäÔ(Ó*Ü§T�T—\’\¨tÜ¯t˜$×+Ò+¸ð€Cð
 ‡N�N¸¿	¹	¼ÔM¹©¨ÄuÔ$�Dœ#˜e›*Ò$¹ÒMÔNØ€Nùó Ns   ÂC
Â*C
c               ó    € V ^8„  d   QhRRRR/# rZ   r   )r!   s   "r   r"   r"   m   s   € ÷ Eñ EÐ-ð E¸ñ Er   c                ó0   € R\        4       /\        V 4      C# )zOEvery identity header for one connector HTTP attempt. Call it once per attempt.z
User-Agent)rI   rj   )r[   s   &r   Úconnector_headersrm   m   s   € àœ*›,ÐDÔ*=¸dÓ*CÐDÐDr   c               ó    € V ^8„  d   QhRRRR/# )r   ÚresponseÚobjectr   r   r   )r!   s   "r   r"   r"   r   s   € ÷ )ñ ) &ð )¨]ñ )r   c                óÒ   € \        V R R4      p\        V\        4      '       g   R# VP                  \        4      ;'       g    VP                  R4      pV'       d   \        V4      # R# )rf   NzX-Request-Id)ÚgetattrÚ
isinstancer   rF   r^   r    )ro   rf   ri   s   &  r   Úresponse_request_idrt   r   sQ   € Ü�h 	¨4Ó0€GÜ�gœw×'Ò'ÙØ�K‰KÔ)Ó*×IÐI¨g¯k©k¸.Ó.I€EßŒ3ˆu‹:Ð( DÐ(r   ÚcodeÚ
request_idr[   c               ó0   € V ^8„  d   QhRRRRRRRRRR	R
R/# )r   Úrouter    ÚstatuszOptional[int]ru   r   rv   r[   r\   r   ÚNoner   )r!   s   "r   r"   r"   z   s>   € ÷ ñ ØðØ%ðØ0=ðØR_ðà
ðð 
ñr   c          
     ó  € Ve   V\         9  d   \        P                  M\        P                  p\        P                  TRYe   TMRT;'       g    RT;'       g    RV'       d   VP                  MR;'       g    R4       R# )zëOne line per connector HTTP outcome: failures at WARNING, success and expected misses at DEBUG.

The ``code`` makes a line a failure, not the status: a 200 whose body failed carries one, and a
304 that refreshed a cached list does not.Nz,connector %s %s %s request_id=%s dispatch=%sÚ	transportÚ-)Ú_EXPECTED_MISSESÚloggingÚWARNINGÚDEBUGÚloggerÚlogr   )rx   ry   ru   rv   r[   Úlevels   &&$$$ r   Úlog_connector_outcomer…   z   sg   € ð  $Ò/°DÔ@PÔ4PŒG�OŠOÔV]×VcÑVc€EÜ
‡J�JØÐ=ØÒ+‰v°¸d¿k¸kÀcÈ:×K\ÐK\ÐY\ß"ˆ×	Ò	¨×4Ð4°ör   )r   rm   rj   r…   r=   rt   rI   )N)r   Ú
__future__r   r   r_   Údataclassesr   Útypingr   r   Ú	getLoggerr   r‚   Ú__all__ra   rb   rc   r^   rE   Ú	frozensetr~   r   r4   r=   rI   rR   rX   rj   rm   rt   r…   r   r   r   Ú<module>rŒ      sÜ   ðñõ #ã Û Ý !ß $à	×	Ò	˜8Ó	$€ò€ð )€Ø"€Ø,Ð Ø"Ð ð ˜ ¨'°7¸IÐF€
ñ Ð4Ð5Ó6Ð ñ �$Ô÷'ð 'ó ð'õ\õ$8õ^õNõZ÷÷Eõ
)ðØ@DðØbfðà"÷ñ r   