+
    „WÝj�  ã                  ól  a € 0 t $ R t^ RIHt ^ RIt^ RIt^ RIHt ^ RIH	t	H
t
HtHtHt ^ RIHtHtHt ]P$                  ! ]4      t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/tR]R&   R]3R]3R	]]3R]3R]]3/tR]R&   ]P<                  ! R4      tR R lt R R lt!R R lt"R  R! lt#R" R# lt$R$ R% lt%R# )&uÛ  Plugin-declared settings fields for the Desktop/TUI Plugins hub (#46600, #87934).

A ``plugin.yaml`` ``config_schema`` describes the keys under ``plugins.entries.<id>.settings``.
This module turns that schema into renderable form fields (type, current value, choices) and
writes edits back through :func:`hermes_cli.plugins_state.save_plugin_setting` â€” the same writer
``ctx.set_config`` uses, so the CLI, the plugin and the Desktop never disagree on where a
setting lives. Secrets are declared with ``type: secret`` and never touch ``config.yaml``: the
field carries the ``.env`` name (``env:`` or ``<PLUGIN>_<KEY>``) plus a presence flag, and the
client writes the value through the existing ``PUT /api/env`` credential route.
)ÚannotationsN)ÚPath)ÚAnyÚDictÚListÚMappingÚOptional)Ú_plugin_relative_segmentsÚ_plugin_settings_entryÚsave_plugin_settingÚstrÚstringÚintÚnumberÚintegerÚfloatÚboolÚbooleanÚlistÚjsonÚarrayÚdictÚobjectÚsecretzdict[str, str]Ú_FIELD_TYPESÚenumzdict[str, tuple]Ú_VALUE_TYPESz
[^A-Z0-9]+c               ó    € V ^8„  d   QhRRRR/# )é   Ú
plugin_dirúOptional[Path]ÚreturnzMapping[str, Mapping[str, Any]]© )Úformats   "ÚOC:\Users\johnn\AppData\Local\hermes\hermes-agent\hermes_cli\plugins_settings.pyÚ__annotate__r%   &   s   € ÷ Iñ I¨ð IÐ;Zñ Ió    c                óV  € V f   / # \        V 4      R,          p VP                  4       '       dS   ^ RIHp V! VP	                  RR7      4      ;'       g    / p\        V\        4      '       d   VP                  R4      MRpM\        \        V 4      4      p \        V\        4      '       g   / # VP                  4        UUu/ uF)  w  rg\        V\        4      '       g   K  \        V4      VbK+  	  upp#   \         d#   p\        P                  RY4       / u Rp?# Rp?ii ; iu uppi )ae  ``config_schema`` from ``<plugin_dir>/plugin.yaml``, or for a portable package from
``plugin.json`` ``extensions.com.nousresearch.hermes.config_schema`` (Agent Plugins v1 forbids
unknown top-level fields, so Hermes-specific keys live in the vendor namespace); ``{}`` when
absent or malformed (the loader already warned about malformed entries at load time).Nzplugin.yaml)Úfast_safe_loadú	utf-8-sig©ÚencodingÚconfig_schemaz3plugin settings: cannot read the manifest in %s: %s)r   Úis_fileÚutilsr(   Ú	read_textÚ
isinstancer   ÚgetÚ_portable_config_schemaÚ	ExceptionÚloggerÚdebugÚitemsr   )r   Úmanifestr(   ÚdataÚrawÚexcÚkÚvs   &       r$   Ú_manifest_config_schemar=   &   sï   € ð
 ÒØˆ	Ü�JÓ -Õ/€Hð	Ø×Ñ×ÒÝ,Ù! (×"4Ñ"4¸kÐ"4Ó"JÓK×QÐQÈrˆDÜ/9¸$Ä×/HÒ/H�$—(‘(˜?Ô+Èd‰Cä)¬$¨zÓ*:Ó;‰Cô �cœ7×#Ò#Øˆ	Ø"%§)¡)¤+ÔH¡+™$˜!´¸A¼w×1GŒIŒC�‹F�AŠI¡+ÒHÐHøô ô Ü�‰ÐJÈJÔ\Ø�	ûðüó
 Is5   š:C5 Á,C5 ÂC5 ÃD%Ã!D%Ã5D"Ä DÄD"ÄD"c               ó    € V ^8„  d   QhRRRR/# )r   r   r   r!   r   r"   )r#   s   "r$   r%   r%   <   s   € ÷ Xñ X¨ð X°ñ Xr&   c                ó¦   € V R ,          pVP                  4       '       g   R# ^ RIp^ RIHp V! VP	                  VP                  RR7      4      4      # )zplugin.jsonN)Úmanifest_config_schemar)   r*   )r-   r   Úhermes_cli.agent_pluginsr@   Úloadsr/   )r   Úportabler   r@   s   &   r$   r2   r2   <   sF   € Ø˜MÕ)€HØ×Ñ×ÒÙÛÝ?Ù! $§*¡*¨X×-?Ñ-?ÈÐ-?Ó-UÓ"VÓWÐWr&   c               ó(   € V ^8„  d   QhRRRRRRRR/# )r   Ú	plugin_idr   ÚkeyÚspecúMapping[str, Any]r!   r"   )r#   s   "r$   r%   r%   F   s/   € ÷ Pñ P˜sð P¨ð PÐ4Eð PÈ#ñ Pr&   c                óê   € \        VP                  R4      ;'       g    R4      P                  4       pV'       d   V# \        P	                  RV  RV 2P                  4       4      P                  R4      # )uº   ``.env`` variable a ``type: secret`` field is stored under: the manifest's ``env:`` or
``<PLUGIN_ID>_<KEY>`` upper-snaked (``image_gen/fal`` + ``api_key`` â†’ ``IMAGE_GEN_FAL_API_KEY``).ÚenvÚ Ú_)r   r1   ÚstripÚ_ENV_NAME_CLEAN_REÚsubÚupper)rE   rF   rG   Údeclareds   &&& r$   Úsecret_env_namerR   F   sa   € ô �4—8‘8˜E“?×(Ð( bÓ)×/Ñ/Ó1€HßØˆÜ×!Ñ! #¨)¨°A°c°UÐ';×'AÑ'AÓ'CÓD×JÑJÈ3ÓOÐOr&   c               ó    € V ^8„  d   QhRRRR/# )r   rG   rH   r!   r   r"   )r#   s   "r$   r%   r%   O   s   € ÷ ñ Ð'ð ¨Cñ r&   c                óP  € V P                  R 4      RJ d   R # \        P                  \        V P                  R4      ;'       g    R4      P                  4       R4      pV P                  RV P                  R4      4      pVR8X  d!   \	        V\
        4      '       d   V'       d   R# V# )r   TÚtyper   r   Úchoicesr   )r1   r   r   Úlowerr0   r   )rG   ÚkindrV   s   &  r$   Ú_field_typerY   O   s~   € Ø‡x�x�Ó˜TÓ!ÙÜ×ÑœC §¡¨Ó 0× 9Ð 9°EÓ:×@Ñ@ÓBÀHÓM€DØ�h‰h�y $§(¡(¨6Ó"2Ó3€GØˆxÔœJ w´×5Ò5¿'ÙØ€Kr&   c               ó$   € V ^8„  d   QhRRRRRR/# )r   rE   r   r   r    r!   zlist[dict[str, Any]]r"   )r#   s   "r$   r%   r%   Y   s"   € ÷ $ñ $ cð $°~ð $ÐJ^ñ $r&   c                óö  € \        V4      pV'       g   . # ^ RIHpHp \	        V! 4       ;'       g    / V 4      ;'       g    / pVP                  R4      p\        V\        4      '       d   TM/ p. pVP                  4        EF\  w  rš \        V	4       \        T
4      pRT	RTR\        T
P                  R4      ;'       g    T
P                  R4      ;'       g    T	4      R\        T
P                  R4      ;'       g    R4      R	\        T
P                  R	4      4      /pTR
8X  d+   \        Y	T
4      pTP                  RTRT! T4      RJ/4       M|T
P                  RT
P                  R4      4      pTR8X  d   T Uu. uF  p\        T4      NK  	  upTR&   RT
9   d   T
R,          TR&   TP                  YšP                  R4      4      TR&   TP!                  T4       EK_  	  V#   \         d     EKr  i ; iu upi )u­   Renderable settings fields for one plugin: schema + the current value of each key.

Secret fields never carry the value â€” only ``env`` (where it lives) and ``has_value``.
)Úget_env_valueÚload_config_readonlyÚsettingsrF   rU   ÚlabelÚtitleÚdescriptionrK   Úrequiredr   rJ   Ú	has_valueNrV   r   ÚdefaultÚvalue)r=   Úhermes_cli.configr\   r]   r
   r1   r0   r   r6   r	   Ú
ValueErrorrY   r   r   rR   ÚupdateÚappend)rE   r   Úschemar\   r]   ÚentryÚraw_currentÚcurrentÚfieldsrF   rG   rX   ÚfieldrJ   rV   Úcs   &&              r$   Úplugin_settings_fieldsrq   Y   sÃ  € ô
 % ZÓ0€FßØˆ	ßEÜ"Ñ#7Ó#9×#?Ð#?¸RÀÓK×QÐQÈr€EØ—)‘)˜JÓ'€KÜ0:¸;Ì×0PÒ0P¡ÐVX€GØ#%€FØ—\‘\—^‰	ˆð	Ü% cÔ*ô ˜4Ó ˆà�3˜ Ø”S˜Ÿ™ 'Ó*×FÐF¨d¯h©h°wÓ.?×FÐFÀ3ÓGØœ3˜tŸx™x¨Ó6×<Ð<¸"Ó=Øœ˜TŸX™X jÓ1Ó2ð	!
ˆð �8ÔÜ! )°$Ó7ˆCØ�L‰L˜%  k±=ÀÓ3EÈTÐ3QÐRÕSà—h‘h˜y¨$¯(©(°6Ó*:Ó;ˆGØ�vŒ~Ù4;Ó#<±G¨q¤C¨¦F±GÑ#<��iÑ Ø˜DÔ Ø#'¨	¥?��iÑ Ø$Ÿ[™[¨¯h©h°yÓ.AÓBˆE�'‰NØ�‰�e×ñ- $ð. €Møô) ô 	Ûð	üò $=s   ÂG#Å;G6Ç#G3Ç2G3c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r   rE   r   r   r    ÚvaluesrH   r!   z	list[str]r"   )r#   s   "r$   r%   r%   €   s*   € ÷ 4ñ 4 Cð 4°^ð 4ÐM^ð 4Ðclñ 4r&   c           
     ó:  € \        V4      p. pVP                  4        EF>  w  rVVP                  \        V4      4      pVf   \	        V: R24      h\        V4      pVR8X  d   \	        V: R24      h\        V,          p	\        Wi4      '       d"   \        V\        4      '       d4   \        V	9  d)   \	        V: RV R\        V4      P                   R24      hVR8X  dN   YgP                  RVP                  R4      4       U
u. uF  p
\        V
4      NK  	  up
9  d   \	        V: R	24      hVP                  \        V4      \        \        V4      4      V34       EKA  	  V F  w  r[p\        WV4       K  	  V UUUu. uF  w  r\qÕNK	  	  uppp# u up
i u upppi )
al  Write ``values`` (``{key: value}``) for the plugin's schema keys; returns the keys written.

Raises ``ValueError`` on an unknown key, a type mismatch, an enum value outside ``choices`` or a
secret (secrets go to ``.env`` through the credential route, never ``config.yaml``);
``PermissionError`` propagates from the shared writer (managed installs / managed keys).
z. is not declared in the plugin's config_schemar   z3 is a secret; it is stored in .env, not config.yamlz should be z (got Ú)r   rV   z$ must be one of the declared choices)r=   r6   r1   r   rg   rY   r   r0   r   rU   Ú__name__ri   r	   r   )rE   r   rs   rj   ÚplanrF   re   rG   rX   Úexpectedrp   ÚsegmentsÚ	_segmentsÚ_values   &&&           r$   Úsave_plugin_settingsr|   €   st  € ô % ZÓ0€FØ€DØ—l‘l—n‰
ˆØ�z‰zœ#˜c›(Ó#ˆØŠ<Ü ™wÐ&TÐUÓVÐVÜ˜4Ó ˆØ�8ÔÜ ™wÐ&YÐZÓ[Ð[Ü Õ%ˆÜ˜%×*Ò*¬z¸%Ä×/FÒ/FÌ4ÐW_ÔK_Ü ™w k°$°°v¼dÀ5»k×>RÑ>RÐ=SÐSTÐUÓVÐVØ�6Œ>˜e¿H¹HÀYÐPT×PXÑPXÐY_ÓP`Ô<aÓ+bÑ<a°q¬C°®FÑ<aÑ+bÔbÜ ™wÐ&JÐKÓLÐLØ�‰”S˜“XÔ8¼¸S»ÓBÀEÐJ×Kñ %ó !%Ñˆ�uÜ˜I°Ö7ñ !%á.2Õ3©dÑ*�C FŠC©dÓ3Ð3ùò ,cùô
 4s   ÄFÅ?F)&Ú__conditional_annotations__Ú__doc__Ú
__future__r   ÚloggingÚreÚpathlibr   Útypingr   r   r   r   r   Úhermes_cli.plugins_stater	   r
   r   Ú	getLoggerrv   r4   r   Ú__annotations__r   r   r   r   r   r   r   ÚcompilerN   r=   r2   rR   rY   rq   r|   )r}   s   @r$   Ú<module>rˆ      sé   øðô	õ #ã Û 	Ý ß 5Õ 5ç kÑ kà	×	Ò	˜8Ó	$€ð 
ˆ8�X˜xØ	ˆ8�Y ¨'°8¸XÀxØ
ˆI�y )Ø
ˆF�G˜V V¨V°X¸vØˆhð €ˆnó ð ˆsˆf�f˜s˜f h°°e°¸iÈ$ÈÐRXÐ[_ÐaeÐZfð"€Ðó ð —Z’Z Ó.Ð õIõ,XõPõõ$÷N4r&   