+
    jHàjR  ã                  óÊ   € R t ^ RIHt ^ RIHt ^ RIHt ^ RIHt RtRt	Rt
R%tRR	R
RRRRRRRRRRRRR/tR R ltR&R R lltRRRRRRRRRRRRRRRRR R/	R! R" lltR# R$ ltR# )'uí  The one field set behind ``/status`` on every surface.

The CLI (``cli_session_mixin._show_session_status``), the messaging gateway
(``gateway/slash_commands_status._handle_status_command``) and the TUI backend
(``tui_gateway/methods_session`` ``session.status``) all report the same session facts â€”
id, home path, title, model route, created / last-activity stamps, lifetime tokens, running
flag. Each used to derive them independently (three ``getattr(agent, "model")`` fallback
chains, three ``updated_at`` candidate scans, three timestamp formats to keep aligned).
They now all call :func:`build_status_fields`; a surface only adds its own header, labels
(the gateway translates through ``t("gateway.status.*")``) and surface-specific extras.
)Úannotations)Údatetime)ÚPath)ÚAnyz%Y-%m-%d %H:%Mz	(unknown)ÚunknownÚ
session_idz
Session IDÚpathr   ÚtitleÚTitleÚmodelÚModelÚcreatedÚCreatedÚlast_activityzLast ActivityÚtokensÚTokensÚagent_runningzAgent Runningc               ó$   € V ^8„  d   QhRRRRRR/# )é   Úvaluer   Údefaultúdatetime | NoneÚreturn© )Úformats   "Ú=/home/ubuntu/.hermes/hermes-agent/hermes_cli/status_report.pyÚ__annotate__r   (   s!   € ÷ ñ ˜ð  oð ¸/ñ ó    c                óœ   € V '       g   V#  \         P                  ! \        V 4      4      #   \        \        \
        \        3 d    Tu # i ; i)zU``datetime.fromtimestamp(value)`` or *default* when the value is missing/unparseable.)r   ÚfromtimestampÚfloatÚ	TypeErrorÚ
ValueErrorÚOverflowErrorÚOSError)r   r   s   &&r   Útimestamp_orr%   (   sA   € çØˆðÜ×%Ò%¤e¨E£lÓ3Ð3øÜ”z¤=´'Ð:ô ØŠðús   Œ+ «AÁ
ANc               ó$   € V ^8„  d   QhRRRRRR/# )r   ÚmetaÚdictÚcreated_fallbackr   r   ztuple[datetime, datetime]r   )r   s   "r   r   r   2   s"   € ÷ ñ ˜Tð °_ð ÐPiñ r   c                ó¼   a € \        S P                  R4      V4      ;'       g    \        P                  ! 4       p\	        R V 3R l\
         4        4       V4      pW#3# )zW``(created, last_activity)`` from a SessionDB row; last activity falls back to created.Ú
started_atc              3  ó8   "  € T F  q'       g   K  Vx € K  	  R # 5i©Nr   )Ú.0Ústamps   & r   Ú	<genexpr>Ú%session_timestamps.<locals>.<genexpr>6   s   é € ÐfÑ\�5Ó`e�ŠÓ\ùs   ‚	�
c              3  óZ   <"  € T F   p\        SP                  V4      R 4      x € K"  	  R # 5ir-   )r%   Úget)r.   Úfr'   s   & €r   r0   r1   6   s%   øé € Ð\ÑF[Àœ\¨$¯(©(°1«+°t×<Ð<ÓF[ùs   ƒ(+)r%   r3   r   ÚnowÚnextÚ_LAST_ACTIVITY_FIELDS)r'   r)   r   Úupdateds   f&  r   Úsession_timestampsr9   2   sN   ø€ ä˜4Ÿ8™8 LÓ1Ð3CÓD×VÐVÌÏÊË€GÜÙfÔ\ÕF[Ô\ÓfØó€Gð ÐÐr   Úproviderr)   FÚhomec               óL   € V ^8„  d   QhRRRRRRRRR	RR
RRRRRRRRRRRRRRR/# )r   r   ÚstrÚagentr   r'   zdict | Noner	   z
str | Noner   r:   r   r   r   r)   r   z
int | Noner   Úboolr;   zstr | Path | Noner   údict[str, Any]r   )r   s   "r   r   r   <   sŠ   € ÷ ,ñ ,Øð,àð,ð ð,ð
 ð,ð ð,ð ð,ð ð,ð #ð,ð &ð,ð ð,ð ð,ð ð,ð ñ,r   c       	        ó˜  € ^ RI Hp T;'       g    / pVe   Vf&   \        W(4      w  rÞT;'       g    TpT;'       g    TpV	f   \        VR^ 4      ;'       g    ^ p	Vf   VP	                  R4      MTpR\        T ;'       g    R4      RT! V'       d   \        V4      MR4      RT;'       g    RP                  4       R\        VRR4      ;'       g    T;'       g    RR	\        VR	R4      ;'       g    T;'       g    RR
VP                  \        4      RVP                  \        4      R\        T	;'       g    ^ 4      R R\        V
4      /	# )a  Common ``/status`` facts, pre-formatted for display.

``agent`` wins for model / provider / tokens; the keyword values are the surface's fallback
(CLI ``self.model``, TUI metadata mirror, gateway's resolved route) and are also what a
surface passes when it has no live agent. ``created`` / ``last_activity`` override the
``meta`` row scan for surfaces whose session store is authoritative (gateway SessionEntry).
``home`` is an explicit owning-profile path for multiplexed surfaces; omitted callers keep
the process/current-profile lookup.
)Údisplay_hermes_homeNÚsession_total_tokensr	   r   Ú r   r   r:   r   r   r   Ú,r   )Úhermes_constantsrB   r9   Úgetattrr3   r=   r   ÚstripÚstrftimeÚSTATUS_STAMPÚintr?   )r   r>   r'   r	   r   r:   r   r   r)   r   r   r;   rB   Úrow_createdÚrow_updatedÚ	row_titles   &&&$$$$$$$$$    r   Úbuild_status_fieldsrO   <   s1  € õ0 5à�:ˆ:�2€DØ‚˜-Ò/Ü#5°dÓ#MÑ ˆØ×(Ð(˜[ˆØ%×4Ð4¨ˆØ‚~Ü˜Ð 6¸Ó:×?Ð?¸aˆØ%*¢]�—‘˜Ô!¸€Ià”c˜*×*Ð*¨Ó+ØÑ#·$¤D¨¤J¸DÓAØ�)—/�/˜r×(Ñ(Ó*Ø”˜ ¨Ó.×=Ð=°%×=Ð=¸2Ø”G˜E :¨tÓ4×FÐF¸×FÐFÀBØ�7×#Ñ#¤LÓ1Ø˜×/Ñ/´Ó=Ø”S˜Ÿ˜ 1Ó% aÐ(Øœ˜mÓ,ð
ð 
r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Úfieldsr@   Úkeysr=   r   z	list[str]r   )r   s   "r   r   r   k   s!   € ÷ ñ ˜ð °ð ¸	ñ r   c                ó*  € . pV FŠ  pW,          pVR8X  d   V'       g   K  VR8X  d4   V R,          ;'       g    \          RV R,          ;'       g    \         R2pMVR8X  d   V'       d   RMRpVP                  \        V,           R	V 24       KŒ  	  V# )
z¬``Label: value`` lines for *keys* in order (English surfaces). An empty title is skipped;
an unresolved model/provider shows a placeholder rather than an empty parenthesis.r	   r   z (r:   Ú)r   ÚYesÚNoz: )ÚUNKNOWN_MODELÚUNKNOWN_PROVIDERÚappendÚSTATUS_LABELS)rQ   rR   ÚlinesÚkeyr   s   &*   r   Ústatus_linesr]   k   s‘   € ð €EÛˆØ•ˆØ�'Œ>§%ÙØ�'Œ>Ø˜g•×7Ð7¬-Ð8¸¸6À*Õ;M×;aÐ;aÔQaÐ:bÐbcÐd‰EØ�OÔ#ß"‘E¨ˆEØ�‰œ cÕ*Ð+¨2¨e¨WÐ5Ö6ñ ð €Lr   )Ú
updated_atÚlast_updated_atÚlast_activity_atr-   )Ú__doc__Ú
__future__r   r   Úpathlibr   Útypingr   rJ   rW   rX   r7   rZ   r%   r9   rO   r]   r   r   r   Ú<module>re      sÑ   ðñ
õ #å Ý Ý à€à€ØÐ ð NÐ ð �,Ø
ˆFØˆWØˆWØˆyØ�_ØˆhØ�_ð	€õ÷ð,ð
 ð,ð ð,ð  ð,ð  $ð,ð &*ð,ð )-ð,ð ð,ð  ð,ð #÷,÷^r   