§
    ‰eîiB  ã                  ó¦   — d Z ddlmZ ddlZddlmZ ddlmZmZm	Z	  ej
        e¦  «        ZdZdZdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zdd„Zg d¢ZdS )uÄ  
Contextual first-touch onboarding hints.

Instead of blocking first-run questionnaires, show a one-time hint the *first*
time a user hits a behavior fork â€” message-while-running, first long-running
tool, etc.  Each hint is shown once per install (tracked in ``config.yaml`` under
``onboarding.seen.<flag>``) and then never again.

Keep this module tiny and dependency-free so both the CLI and gateway can import
it without pulling in heavy modules.
é    )ÚannotationsN)ÚPath)ÚAnyÚMappingÚOptionalÚbusy_input_promptÚtool_progress_promptÚmodeÚstrÚreturnc                ó   — | dk    r	 dS 	 dS )uá   Hint shown the first time a user messages while the agent is busy.

    ``mode`` is the effective busy_input_mode that was just applied, so the
    message matches reality ("I just interruptedâ€¦" vs "I just queuedâ€¦").
    ÚqueueuÑ   ðŸ’¡ First-time tip â€” I queued your message instead of interrupting. Send `/busy interrupt` to make new messages stop the current task immediately, or `/busy status` to check. This notice won't appear again.uÐ   ðŸ’¡ First-time tip â€” I just interrupted my current task to answer you. Send `/busy queue` to queue follow-ups for after the current task instead, or `/busy status` to check. This notice won't appear again.© ©r
   s    ú2/home/div/.hermes/hermes-agent/agent/onboarding.pyÚbusy_input_hint_gatewayr   "   s-   € ð ˆw‚€ðWð	
ð 	
ð	Fðð ó    c                ó   — | dk    r	 dS 	 dS )z=CLI version of the busy-input hint (plain text, no markdown).r   zŠ(tip) Your message was queued for the next turn. Use /busy interrupt to make Enter stop the current run instead. This tip only shows once.z†(tip) Your message interrupted the current run. Use /busy queue to queue messages for the next turn instead. This tip only shows once.r   r   s    r   Úbusy_input_hint_clir   5   s)   € àˆw‚€ð(ð	
ð 	
ð	$ðð r   c                 ó   — 	 dS )NuÇ   ðŸ’¡ First-time tip â€” that tool took a while and I'm streaming every step. If the progress messages feel noisy, send `/verbose` to cycle modes (all â†’ new â†’ off). This notice won't appear again.r   r   r   r   Útool_progress_hint_gatewayr   D   s   € ð	Aðð r   c                 ó   — 	 dS )NzŒ(tip) That tool ran for a while. Use /verbose to cycle tool-progress display modes (all -> new -> off -> verbose). This tip only shows once.r   r   r   r   Útool_progress_hint_clir   L   s   € ð	Rðð r   ÚconfigúMapping[str, Any]c                óä   — t          | t          ¦  «        r|                      d¦  «        nd }t          |t          ¦  «        si S |                     d¦  «        }t          |t          ¦  «        r|ni S )NÚ
onboardingÚseen)Ú
isinstancer   Úget)r   r   r   s      r   Ú_get_seen_dictr!   W   sh   € Ý-7¸ÅÑ-HÔ-HÐR�—’˜LÑ)Ô)Ð)Èd€JÝ�j¥'Ñ*Ô*ð Øˆ	Ø�>Š>˜&Ñ!Ô!€DÝ˜d¥GÑ,Ô,Ð4ˆ4ˆ4°"Ð4r   ÚflagÚboolc                ó`   — t          t          | ¦  «                             |¦  «        ¦  «        S )zEReturn True if the user has already been shown this first-touch hint.)r#   r!   r    )r   r"   s     r   Úis_seenr%   _   s&   € å•˜vÑ&Ô&×*Ò*¨4Ñ0Ô0Ñ1Ô1Ð1r   Úconfig_pathr   c                óÂ  — 	 ddl }ddlm} n3# t          $ r&}t                               d|¦  «         Y d}~dS d}~ww xY w	 i }|                      ¦   «         r@t          | d¬¦  «        5 }|                     |¦  «        pi }ddd¦  «         n# 1 swxY w Y   t          | 
                    d¦  «        t          ¦  «        si |d<   |d          
                    d	¦  «        }t          |t          ¦  «        si }||d         d	<   | 
                    |¦  «        d
u rd
S d
||<    || |¦  «         d
S # t          $ r'}t                               d||¦  «         Y d}~dS d}~ww xY w)u   Persist ``onboarding.seen.<flag> = True`` to ``config_path``.

    Uses the atomic YAML writer so a concurrent process can't observe a
    partially-written file.  Returns True on success, False on any error
    (including the config file being absent â€” onboarding is best-effort).
    r   N)Úatomic_yaml_writez+onboarding: failed to import yaml/utils: %sFzutf-8)Úencodingr   r   Tz&onboarding: failed to mark flag %s: %s)ÚyamlÚutilsr(   Ú	ExceptionÚloggerÚdebugÚexistsÚopenÚ	safe_loadr   r    Údict)r&   r"   r*   r(   ÚeÚcfgÚfr   s           r   Ú	mark_seenr6   d   sã  € ðØˆˆˆØ+Ð+Ð+Ð+Ð+Ð+Ð+øÝð ð ð Ý�ŠÐBÀAÑFÔFÐFØˆuˆuˆuˆuˆuøøøøðøøøðØˆØ×ÒÑÔð 	.Ý�k¨GÐ4Ñ4Ô4ð .¸Ø—n’n QÑ'Ô'Ð-¨2�ð.ð .ð .ñ .ô .ð .ð .ð .ð .ð .ð .øøøð .ð .ð .ð .å˜#Ÿ'š' ,Ñ/Ô/µÑ6Ô6ð 	#Ø "ˆC�ÑØ�<Ô ×$Ò$ VÑ,Ô,ˆÝ˜$¥Ñ%Ô%ð 	-ØˆDØ(,ˆC�Ô˜fÑ%Ø�8Š8�D‰>Œ>˜TÐ!Ð!Ø�4ØˆˆT‰
ØÐ˜+ sÑ+Ô+Ð+ØˆtøÝð ð ð Ý�ŠÐ=¸tÀQÑGÔGÐGØˆuˆuˆuˆuˆuøøøøðøøøsS   ‚
 �
=—8¸=Á'D- Á(BÂ D- ÂBÂD- ÂBÂBD- ÄD- Ä-
EÄ7EÅE)ÚBUSY_INPUT_FLAGÚTOOL_PROGRESS_FLAGr   r   r   r   r%   r6   )r
   r   r   r   )r   r   )r   r   r   r   )r   r   r"   r   r   r#   )r&   r   r"   r   r   r#   )Ú__doc__Ú
__future__r   ÚloggingÚpathlibr   Útypingr   r   r   Ú	getLoggerÚ__name__r-   r7   r8   r   r   r   r   r!   r%   r6   Ú__all__r   r   r   ú<module>rA      s  ðð
ð 
ð #Ð "Ð "Ð "Ð "Ð "à €€€Ø Ð Ð Ð Ð Ð Ø )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ð )à	ˆÔ	˜8Ñ	$Ô	$€ð &€Ø+Ð ðð ð ð ð&ð ð ð ðð ð ð ðð ð ð ð5ð 5ð 5ð 5ð2ð 2ð 2ð 2ð
 ð  ð  ð  ðF	ð 	ð 	€€€r   