
    ,j|$              	         U d Z ddlmZ ddlmZ dddddddddZd	ed
<   ddddddddZddddddddZddddddddZ	ddddddddZ
i di eddddedi eddidededede	dede	de	de	de	de	de	de
d e
d!e
e
i ed"did#Zd$ed%<    ee                                          Z	 d1d2d.Zd3d0ZdS )4u  Per-platform display/verbosity configuration resolver.

Provides ``resolve_display_setting()`` — the single entry-point for reading
display settings with platform-specific overrides and sensible defaults.

Resolution order (first non-None wins):
    1. ``display.platforms.<platform>.<key>``  — explicit per-platform user override
    2. ``display.<key>``                       — global user setting
    3. ``_PLATFORM_DEFAULTS[<platform>][<key>]``  — built-in sensible default
    4. ``_GLOBAL_DEFAULTS[<key>]``              — built-in global default

Exception: ``display.streaming`` is CLI-only.  Gateway streaming follows the
top-level ``streaming`` config unless ``display.platforms.<platform>.streaming``
sets an explicit per-platform override.

Backward compatibility: ``display.tool_progress_overrides`` is still read as a
fallback for ``tool_progress`` when no ``display.platforms`` entry exists.  A
config migration (version bump) automatically moves the old format into the new
``display.platforms`` structure.
    )annotations)AnyallFNT)tool_progressshow_reasoningtool_preview_length	streaminginterim_assistant_messageslong_running_notificationsbusy_ack_detailcleanup_progresszdict[str, Any]_GLOBAL_DEFAULTS(   )r   r   r   r	   r
   r   r   newofftelegram)r   r   discordslackr   
mattermostmatrixfeishusignalwhatsappwhatsapp_cloudbluebubblesweixinwecomwecom_callbackdingtalkemailsmswebhookr   )homeassistant
api_serverzdict[str, dict[str, Any]]_PLATFORM_DEFAULTSuser_configdictplatform_keystrsettingfallbackr   returnc                   |                      d          pi }|                     d          pi }|                     |          }t          |t                    r'|                     |          }|t          ||          S |dk    rQ|                     d          }t          |t                    r'|                     |          }|t          ||          S |dk    r'|                     |          }|t          ||          S t                               |          }	|	r|	                     |          }||S t
                               |          }||S |S )aP  Resolve a display setting with per-platform override support.

    Parameters
    ----------
    user_config : dict
        The full parsed config.yaml dict.
    platform_key : str
        Platform config key (e.g. ``"telegram"``, ``"slack"``).  Use
        ``_platform_config_key(source.platform)`` from gateway/run.py.
    setting : str
        Display setting name (e.g. ``"tool_progress"``, ``"show_reasoning"``).
    fallback : Any
        Fallback value when the setting isn't found anywhere.

    Returns
    -------
    The resolved value, or *fallback* if nothing is configured.
    display	platformsNr   tool_progress_overridesr	   )get
isinstancer'   
_normaliser%   r   )
r&   r(   r*   r+   display_cfgr/   plat_overridesvallegacyplat_defaultss
             ;/home/ubuntu/.hermes/hermes-agent/gateway/display_config.pyresolve_display_settingr:      se   0 //),,2K ,,2I]]<00N.$'' ,  ))?gs+++ /!!!:;;fd## 	0**\**C!'3///
 +oog&&?gs+++ '**<88M ((?J 

w
'
'C

O    valuec                   | dk    r-|du rdS |du rdS t          |                                          S | dv r:t          |t                     r|                                dv S t          |          S | dk    r:t          |t                     r|                                dv S t          |          S | d	k    r(	 t	          |          S # t
          t          f$ r Y d
S w xY w|S )u;   Normalise YAML quirks (bare ``off`` → False in YAML 1.1).r   Fr   Tr   >   r	   r   r   r
   r   >   1onyestruer   r   r   )r)   lowerr2   boolint	TypeError
ValueError)r*   r<   s     r9   r3   r3      s   /!!E>>5D==55zz!!!    eS!! 	?;;==$>>>E{{$$$eS!! 	?;;==$>>>E{{'''	u:::& 	 	 	11	Ls   9C CC)N)
r&   r'   r(   r)   r*   r)   r+   r   r,   r   )r*   r)   r<   r   r,   r   )__doc__
__future__r   typingr   r   __annotations__
_TIER_HIGH_TIER_MEDIUM	_TIER_LOW_TIER_MINIMALr%   	frozensetkeysOVERRIDEABLE_KEYSr:   r3    r;   r9   <module>rS      s    * # " " " " "        #'"& $ $     6 "&"& 
 "&"&  "'"' 	 "'"' -1  
   -1 :-1& ?,???'-1( |)-1* |+-1, |--12 y3-14 |5-1@ yA-1B yC-1D yE-1F yG-1H yI-1J yK-1P }Q-1R 
}S-1T }U-1V %?*?&;Q??Y-1 -1 -1  - - - -` I.335566  	> > > > >J     r;   