+
    Ej^                     r    R t ^ RIt^ RIt^ RIt^RIHtHtHt ^RIH	t	H
t
HtHt R tR tR tR tR tR	 tR# )
u   sshj.lastused — last-called recording + seeding (leaf-ish).

B2 step 3c: moved verbatim from sshj_cli.py (single-file era) — no
behavior change. Edges: jsonio (state files) and discover
(SSH_FLAG_ARGS for history parsing).
N)SSH_FLAG_ARGSHISTORY_SCAN_TAIL
tail_lines)LAST_USED_FILELAST_SUCCESS_FILE	load_json	save_jsonc                 "    \        \        / 4      # )z*alias->epoch map, or {} if never recorded.)r   r        src/sshj/lastused.pyload_last_usedr      s    ^R((r   c                h    \        4       p\        P                  ! 4       W&   \        \        V4       R# )z3Stamp an alias's last-used time to now and persist.N)r   timer   r   aliasds   & r   record_last_usedr      s!    Ayy{AHna r   c                 "    \        \        / 4      # )z6alias->epoch of the last SUCCESSFUL connection, or {}.)r   r   r
   r   r   load_last_successr      s    &++r   c                h    \        4       p\        P                  ! 4       W&   \        \        V4       R# )u   Stamp an alias's last-success time to now and persist. Called only
when ssh actually exits 0 — a failed attempt updates last_used (it was
tried) but must not move the host up in last-success order.N)r   r   r   r   r   s   & r   record_last_successr   !   s$     	Ayy{AH#r   c                L   \        4       pV'       d   V# \        P                  P                  R4      ;'       g     \        P                  P                  R4      p\        V\        4      pV  Uu/ uF  qDR,          VR,          bK  	  pp/ pV  F4  pVR,          '       g   K  VP                  VR,          VR,          4       K6  	  Rp \        P                  P                  V4      pV EF  p	V	P                  R4      '       d$    \        V	R,          P                  4       4      pK>  V	P                  4       p
V
'       g   KX   \         P"                  ! V
4      pT'       d,   \        P                  P%                  T^ ,          4      R8w  d   K  ^pT\'        T4      8  dJ   Y,          pTR8X  d   M9TP                  R	4      '       d"   T\(        9   d   T^,          pKM  T^,          pKX   T\'        T4      8  d   EK  Y,          pRpY9   d   TpMrR
T9   d[   TP+                  R
4      ^,          P-                  R^4      ^ ,          pTP                  T4      ;'       g    TP                  T4      pMTP                  T4      pT'       g   EK  \/        TP                  T^ 4      T'       d   TMT4      Y&   EK  	  V'       d   \1        \2        V4       V# u upi   \         d    \        P                  ! 4       p ELi ; i  \         d    Rp ELi ; i  \         d     EK8  i ; i)z<Seed last-used from shell history when none is recorded yet.HISTFILEz~/.bash_historyr   hostnameN#:   NNssh-@:)r   osenvirongetpath
expanduserr   r   
setdefaultgetmtimeOSErrorr   
startswithintstrip
ValueErrorshlexsplitbasenamelenr   
rpartitionrsplitmaxr   r   )hostsr   histlineshby_alias	by_targettsfallbacklnstoksittargetr   hostparts   &                r   seed_from_historyrC   *   s   A::>>*%NN););<M)ND t./E0561'
AgJ&H6IZ==  :'
;  
B77##D) ==B( HHJ	;;q>D rww''Q0E9#d)mAEz||C  %FAFAD	>EF]((-a077Q?BHLL*EEimmH.EEMM&)E5155?"B(CAHQ R 	.!$Hk 7  99;    		s<   /K	K  K?L K<;K<?LLL#"L#c                   \        ^ \        V 4      4      p V ^<8  d   V  R2# V ^<,          pV^<8  d   V R2# V R,          pV^8  d   V R2# V R,          pV^8  d   V R2# V R,          pV^8  d   V R2# V R,           R	2# )
z9Compact age: up to 3 digits + 1-char label (s/m/h/d/m/y).r=   mi  r7   iQ r   i ' i3y)r3   r*   )secrE   r7   r   mos   &    r   	human_agerI   l   s    
aS
C
Rxayr	A2vAwtA2vAwuA2vAw	B	BwQxXoa  r   )__doc__r!   r-   r   discoverr   r   r   jsonior   r   r   r   r   r   r   r   rC   rI   r
   r   r   <module>rM      s@    
   B B K K)
!,
$?D!r   