+
    jHàjŠZ  ã                  óø  € R t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	H
t
 ^ RIHtHt ^ RIHt ^ RIHt ^ RIHt ^ RIHtHtHtHtHtHtHtHtHtHtHtH t H!t!H"t" ^ R	I#H$t$H%t%H&t&H't' ^ R
I(H)t) ]t*]"t+Rt,Rt-Rt.R t/R R lt0R R lt1R R lt2R R lt3R R lt4R R lt5R R lt6R R lt7R R  lt8R! R" lt9R# R$ lt:R% R& lt;R' R( lt<R) R* lt=R+ R, lt>R-R./R/ R0 llt?R5t@R-R./R1 R2 lltAR6R7.tBR3 R4 ltCR# )8z2CLI handlers for ``hermes secrets bitwarden ...``.)ÚannotationsN)ÚPath)ÚListÚOptional)ÚConsole)ÚPanel)ÚTable)ÚargÚcfg_strÚcli_versionÚdisable_secret_sourceÚflagÚprint_status_panelÚprint_tableÚprompt_indexÚregister_subcommandsÚrequire_enabledÚrotate_tokenÚsecret_cli_envÚsection_cfgÚyn)Úget_env_pathÚload_configÚsave_configÚsave_env_value)Úmasked_secret_promptÚBWS_ACCESS_TOKENu‚   [yellow]Warning: token doesn't start with '0.' â€” usually that means you pasted something other than a BSM access token.[/yellow]u˜     [yellow]Warning: token doesn't start with '0.' â€” usually that means you pasted something other than a BSM access token.  Continuing anyway.[/yellow]c                 ó   € ^ RI Hp  V # )zHImport ``agent.secret_sources.bitwarden`` on first use (crypto payload).©Ú	bitwarden)Úagent.secret_sourcesr   )Ú_bws    Ú;/home/ubuntu/.hermes/hermes-agent/hermes_cli/secrets_cli.pyÚ_load_bwr#   *   s
   € å5Ø€Jó    c               ó   € V ^8„  d   QhRR/# )é   ÚnameÚstr© )Úformats   "r"   Ú__annotate__r+   0   s   € ÷ Kñ K�cñ Kr$   c                óR   € V R8X  d   \        4       # \        R\        : RV : 24      h)u'  PEP 562 lazy ``bw`` attribute (tests monkeypatch ``secrets_cli.bw``); an eager binding
would re-import ``cryptography`` at import time.

Existing callers (and upstream tests) monkeypatch attributes on ``hermes_cli.secrets_cli.bw`` directly.
Resolving that attribute at module-import time would re-import ``cryptography`` eagerly â€” the very
self-lock we are preventing (#86781). Defer the backend import until the first actual attribute access,
so ``import hermes_cli.secrets_cli`` stays crypto-free while ``secrets_cli.bw.find_bws`` still resolves.
Úbwzmodule z has no attribute )r#   ÚAttributeErrorÚ__name__)r'   s   &r"   Ú__getattr__r0   0   s,   € ð ˆt„|Ü‹zÐÜ
˜7¤8¡,Ð.@ÀÁÐIÓ
JÐJr$   c               ó    € V ^8„  d   QhRRRR/# )r&   Úparent_parserzargparse.ArgumentParserÚreturnÚNoner)   )r*   s   "r"   r+   r+   A   s   € ÷ ñ Ð 7ð ¸Dñ r$   c                ó&  € \        V RRR\        \        RR4      \        RR4      \        RR	4      33R
R\        R3RR\        \        RR4      \        RR4      33RR\        \        RR4      33RR\        R3RR\        \        RR4      3334       R# )z<Attach the ``bitwarden`` subcommand tree to a parent parser.Úsecrets_bw_commandÚsetupzAInteractive wizard: install bws, store access token, pick projectú--project-idz.Pre-select a project UUID instead of promptingú--access-tokenzCProvide the access token non-interactively (will be stored in .env)ú--server-urlz¼Bitwarden region / self-hosted endpoint. Examples: https://vault.bitwarden.com (US, default), https://vault.bitwarden.eu (EU), or your self-hosted URL. Skips the interactive region prompt.Ústatusz.Show config + binary + token validation statusÚtokenz@Rotate the access token: validate a new one and store it in .envz@Provide the new token non-interactively (default: masked prompt)z--no-verifyz7Store without probing Bitwarden first (not recommended)Úsyncz)Fetch secrets now and report what changedz--applyzKActually export the secrets into the current shell's env (default: dry-run)Údisablez"Turn off the Bitwarden integrationÚinstallz Install the PM-pinned bws binaryz--forcez"Verify and repair the managed copyNr)   )	r   Ú	cmd_setupr	   Ú
cmd_statusÚ	cmd_tokenr   Úcmd_syncÚcmd_disableÚcmd_install)r2   s   &r"   Úregister_clirF   A   sÖ   € ä˜Ð(<Ø	ÐUÔW`Ü�Ð PÓQÜÐ Ð"gÓhÜ�ð7óð	c
ð 		ð 
ÐCÄZÐQSÐTØ	ÐTÔV_ÜÐ Ð"dÓeÜ�Ð YÓZðb
ð 	ð 
Ð<¼hÜ�ÐiÓjðI
ð 	ð 
Ð8¼+ÀrÐJØ	Ð6¼Ü�Ð@ÓAðF
ð 	ð)?ö r$   c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r&   Úconsoler   ÚnÚintÚtitler(   r3   r4   r)   )r*   s   "r"   r+   r+   `   s(   € ÷ 5ñ 5�7ð 5˜sð 5¨3ð 5°4ñ 5r$   c                óT   € V P                  4        V P                  R V RV 24       R# )z[bold]Step z	[/bold]  N)Úprint)rH   rI   rK   s   &&&r"   Ú_steprN   `   s$   € Ø‡M�M„OØ‡M�M�K ˜s )¨E¨7Ð3Ö4r$   c               ó    € V ^8„  d   QhRRRR/# )r&   rH   r   r3   úOptional[Path]r)   )r*   s   "r"   r+   r+   e   s   € ÷ ñ ˜wð ¨>ñ r$   c                óP  € \        V^R4        V P                  RR7      pVf"   VP                  R4       V P                  4       pVP                  RV R\	        V4       R24       V#   \
         d2   pTP                  R	T R
24       TP                  R4        Rp?R# Rp?ii ; i)zAStep 1: locate or download bws; None (after printing) on failure.zInstall the bws CLIF©Úinstall_if_missingNu#     No bws on PATH â€” downloadingâ€¦u     [green]âœ“[/green] ú  (Ú)u"     [red]âœ— Could not install bws: ú[/red]z>  Manual install: https://github.com/bitwarden/sdk-sm/releases)rN   Úfind_bwsrM   Úinstall_bwsÚ_bws_versionÚ	Exception)r-   rH   ÚbinaryÚexcs   &&  r"   Ú_setup_binaryr]   e   sŸ   € ä	ˆ'�1Ð+Ô,ð
Ø—‘°�Ó6ˆØŠ>Ø�M‰MÐ?Ô@Ø—^‘^Ó%ˆFØ�‰Ð-¨f¨X°S¼ÀfÓ9MÐ8NÈaÐPÔQØˆøÜô Ø�‰Ð:¸3¸%¸vÐFÔGØ�‰ÐVÔWÝûðús   �AA) Á)B%Á4&B Â B%c               ó    € V ^8„  d   QhRRRR/# )r&   Úargsúargparse.Namespacer3   z	list[str]r)   )r*   s   "r"   r+   r+   u   s   € ÷ Wñ WÐ(:ð W¸yñ Wr$   c                ób  € RV P                   RV P                  ;'       g    RP                  4       ;'       g!    \        P                  P                  RR4      RV P                  /pVP                  4        UUu. uF'  w  r#V'       d   VP                  4       '       d   K%  VNK)  	  upp# u uppi )zWSetup flags a no-TTY run must supply (BWS_SERVER_URL env substitutes for --server-url).r9   r:   Ú ÚBWS_SERVER_URLr8   )Úaccess_tokenÚ
server_urlÚstripÚosÚenvironÚgetÚ
project_idÚitems)r_   Úprovidedr   Úvalues   &   r"   Ú_missing_noninteractive_flagsrn   u   sƒ   € ð 	˜$×+Ñ+Ø˜Ÿ™×.Ð.¨B×5Ñ5Ó7×_Ð_¼2¿:¹:¿>¹>ÐJZÐ\^Ó;_Ø˜Ÿ™ð)€Hð %-§N¡NÔ$4ÔVÑ$4‘[�T¿UÀuÇ{Á{Ç}�DˆDÑ$4ÒVÐVùÓVs   Á:"B+Â!B+c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r&   r_   r`   rH   r   Ú	token_envr(   r3   úOptional[str]r)   )r*   s   "r"   r+   r+   ~   s*   € ÷ ñ Ð)ð °Gð Èð ÐP]ñ r$   c                óº  € \        V^R4       V P                  ;'       g    RP                  4       ;'       g    \        RV R24      P                  4       pV'       g   VP	                  R4       R# VP                  R4      '       g   VP	                  \        4       \        W#4       V\        P                  V&   VP	                  R\        4        R	V 24       V# )
zQStep 2: take the token from ``--access-token`` or a masked prompt and persist it.zProvide your access tokenrb   z  Paste access token (ú): z#  [red]Empty token, aborting.[/red]Nú0.u     [green]âœ“[/green] stored in z as )rN   rd   rf   r   rM   Ú
startswithÚ!_NOT_BSM_TOKEN_WARNING_CONTINUINGr   rg   rh   r   )r_   rH   rp   r<   s   &&& r"   Ú_setup_tokenrw   ~   s¸   € ä	ˆ'�1Ð1Ô2Ø×Ñ×$Ð$ "×+Ñ+Ó-×vÐvÔ1EÐH^Ð_hÐ^iÐilÐFmÓ1n×1tÑ1tÓ1v€EßØ�‰Ð;Ô<ÙØ×Ñ˜D×!Ò!Ø�‰Ô7Ô8Ü�9Ô$Ø!„B‡J�JˆyÑØ‡M�MÐ3´L³NÐ3CÀ4È	À{ÐSÔTØ€Lr$   c          
     ó,   € V ^8„  d   QhRRRRRRRRRR	/# )
r&   r[   r   r<   r(   rH   r   re   r3   rq   r)   )r*   s   "r"   r+   r+   �   s0   € ÷ #ñ #˜4ð #¨ð #°gð #È3ð #ÐS`ñ #r$   c           	     ób  € \        V^R4       \        WW#R7      pVf   R# V'       g%   VP                  R4       VP                  R4       R# \        VRRRR	^/3R
RRR/33R \	        V^4       4       4       \        VR\        V4       R2\        V4      4      pWE^,
          ,          R,          # )zXStep 4: list projects and let the user pick one; None (after printing) when none usable.zPick a project©re   Nz?  [yellow]No projects visible to this machine account.[/yellow]ur     In the Bitwarden web app, open the machine account â†’ Projects tab and grant it access to at least one project.Ú#ÚstyleÚcyanÚwidthÚNameÚIDÚdimc              3  ó‚   "  € T F5  w  r\        V4      VP                  R R4      VP                  RR4      3x € K7  	  R# 5i)r'   Ú?ÚidN)r(   ri   )Ú.0ÚiÚps   &  r"   Ú	<genexpr>Ú!_setup_project.<locals>.<genexpr>™   s5   é € ÐcÑLbÁDÀA”#�a“&˜!Ÿ%™% ¨Ó,¨a¯e©e°D¸#Ó.>Õ?ÓLbùs   ‚=?z  Select project [1-z]: r„   )rN   Ú_list_projectsrM   r   Ú	enumerater   Úlen)r[   r<   rH   re   ÚprojectsÚidxs   &&&&  r"   Ú_setup_projectr�   �   s»   € ä	ˆ'�1Ð&Ô'Ü˜f¨WÔL€HØÒÙßØ�‰ÐWÔXØ�‰ð Eô 	FáÜ�˜3 ¨&°'¸1Ð =Ð>ÀÈÐPWÐY^ÐO_ÐH`ÐaÙcÌIÐV^Ð`aÔLbÓcôeä
�wÐ"6´s¸8³}°oÀSÐ IÌ3ÈxË=Ó
Y€CØ˜!•GÕ˜TÕ"Ð"r$   c               ó    € V ^8„  d   QhRRRR/# ©r&   r_   r`   r3   rJ   r)   )r*   s   "r"   r+   r+   ž   s   € ÷ Dñ DÐ&ð D¨3ñ Dr$   c                óh  a€ \        4       p\        4       pVP                  \        P                  ! R RR7      4       \        W4      pVf   ^# \        P                  P                  4       '       g:   \        V 4      pV'       d'   VP                  RRP                  V4       R24       ^# \        4       pVP                  R/ 4      P                  R/ 4      pVP                  R	\        4      o\        WS4      pVf   ^# \!        V^R
4       \#        WV4      pVf   ^# TP                  V'       d   RV 2MR4       V P$                  ;'       g    RP'                  4       p	\)        V	4      p
V
'       g   \+        W7W(4      p	V	f   ^# \!        Y*'       d   ^M^R4        VP-                  WyVRVR7      w  r¼T'       g   TP                  R4       M&\1        TRRR/3R3T3R l\3        T4       4       4       T F  pTP                  RT 24       K  	  TP5                  RY˜R7       R	S3RRR3 F  w  ppTP                  TT4       K  	  \7        T4       TP                  4        TP                  R4       TP                  R4       ^ #   \.         d!   pTP                  RT R24        Rp?^# Rp?ii ; i) u  [bold]Bitwarden Secrets Manager setup[/bold]

Need an access token? In the Bitwarden web app:
  Secrets Manager â†’ Machine accounts â†’ [your account] â†’
  Access tokens â†’ Create access token

Copy the token (starts with [cyan]0.[/cyan]â€¦) â€” it cannot be retrieved later.r}   )Úborder_styleNzP  [red]Non-interactive mode (no TTY) requires all setup flags.[/red]
  Missing: z, z»

  Usage:
    hermes secrets bitwarden setup \
      --access-token '0.xxx' \
      --server-url 'https://vault.bitwarden.com' \
      --project-id 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'Úsecretsr   Úaccess_token_envzPick a Bitwarden regionu     [green]âœ“[/green] using uN     [green]âœ“[/green] using bws default (US Cloud, https://vault.bitwarden.com)rb   z
Test fetchF)rd   rj   r[   Ú	use_cachere   u     [red]âœ— Fetch failed: rV   zB  [yellow]Fetch succeeded but the project has no secrets.[/yellow]r   r|   ÚStatusc              3  ó>   <"  € T F  q\        VS4      3x € K  	  R # 5i©N)Ú_fetch_status)r…   Úkeyrp   s   & €r"   rˆ   Úcmd_setup.<locals>.<genexpr>Ô   s   øé € ÐUÁ_¸cœ=¨¨iÓ8Õ9Ã_ùs   ƒz  [yellow]warning:[/yellow] T)Úenabledrj   re   uv   [green]âœ“ Bitwarden Secrets Manager is enabled.[/green]  Secrets will be pulled at the start of every Hermes process.z¦  Status:  [cyan]hermes secrets bitwarden status[/cyan]
  Refresh: [cyan]hermes secrets bitwarden sync[/cyan]
  Disable: [cyan]hermes secrets bitwarden disable[/cyan])Úcache_ttl_secondsé,  )Úoverride_existingT)Úauto_installT)r#   r   rM   r   Úfitr]   ÚsysÚstdinÚisattyrn   Újoinr   Ú
setdefaultri   Ú_DEFAULT_TOKEN_ENVrw   rN   Ú_resolve_server_urlrj   rf   Úboolr�   Úfetch_bitwarden_secretsrZ   r   ÚsortedÚupdater   )r_   r-   rH   r[   ÚmissingÚcfgÚsecrets_cfgr<   re   rj   Úproject_givenr”   Úwarningsr\   Úwr›   Údefaultrp   s   &                @r"   r@   r@   ž   s�  ø€ Ü	‹€BÜ‹i€GØ‡M�M”%—)’)ð	\ð
 ôô ô ˜2Ó'€FØ‚~ÙÜ�9‰9×Ñ×ÒÜ/°Ó5ˆßØ�M‰MðØ"Ÿi™i¨Ó0Ð1ð 2LðLôMñ Ü
‹-€CØ—.‘. ¨BÓ/×:Ñ:¸;ÈÓK€KØ—‘Ð 2Ô4FÓG€IÜ˜¨	Ó2€EØ‚}ÙÜ	ˆ'�1Ð/Ô0Ü$ T¸Ó@€JØÒÙØ‡M�MÇ
Ð/°
¨|Ñ<Øgôià—/‘/×'Ð' R×.Ñ.Ó0€JÜ˜Ó$€MßÜ# F°7ÓGˆ
ØÒÙÜ	ˆ'ž‘1¨1¨lÔ;ðØ×6Ñ6Ø¸fÐPUÐblð 7ó nÑˆ÷
 Ø�‰ÐZÕ[ä�G˜v¨°Ð'8Ð9¸8ÐDÜUÄVÈGÄ_ÓUô	WãˆØ�‰Ð4°Q°CÐ8Ö9ñ à×Ñ˜t°
ÐÔRØ,¨iÐ8Ð:TØ4Ð6LóN‰ˆˆWà×Ñ˜s GÖ,ñNô �ÔØ‡M�M„OØ‡M�Mð Qô Rà‡M�Mð Mô Nñ øô+ ô Ø�‰Ð1°#°°fÐ=Ô>Ýûðús   ÆJ ÊJ1ÊJ,Ê,J1c               ó    € V ^8„  d   QhRRRR/# )r&   r¯   Údictr3   r)   )r*   s   "r"   r+   r+   å   s   € ÷ )ñ )�ð )˜$ñ )r$   c                ó   € \        V R 4      # r   )r   )r¯   s   &r"   Ú_bw_cfgr¸   å   s   € Ü�s˜KÓ(Ð(r$   c               ó$   € V ^8„  d   QhRRRRRR/# )r&   r›   r(   rp   r3   r)   )r*   s   "r"   r+   r+   é   s!   € ÷  ñ  �sð   sð  ¨sñ  r$   c                ód   € W8X  d   R # \         P                  P                  V 4      '       d   R# R# )u5   [dim]bootstrap token â€” never overrides itself[/dim]z9[yellow]already set in env (will be overwritten)[/yellow]z[green]new[/green])rg   rh   ri   )r›   rp   s   &&r"   rš   rš   é   s$   € Ø
ÔÙFÜ	‡z�z‡~�~�c×ÒÙJÙr$   c               ó    € V ^8„  d   QhRRRR/# r‘   r)   )r*   s   "r"   r+   r+   ñ   s   € ÷ "ñ "Ð'ð "¨Cñ "r$   c                ó  € \        4       p\        4       p\        \        4       4      p\	        VP                  R 4      4      pVP                  R\        4      pVP                  RR4      p\        VR4      p\        P                  P                  VR4      P                  4       pVP                  RR7      p	\        WIW‡R7      w  r«\        TRR	\        V4      3R
V3R\        \	        V4      4      3RV
3RT;'       g    R3RT;'       g    R3R\        \	        VP                  RR4      4      4      3R\        VP                  RR4      4      3R\        \	        VP                  RR4      4      4      3RV	'       d   V	 R\!        V	4       R2MR33
4       V F  pVP#                  V4       K  	  V'       g   VP#                  R4       ^ # V'       g   VP#                  RV R24       V'       g   VP#                  R 4       ^ # )!r�   r•   rj   rb   re   FrR   )r�   r[   r<   re   zBitwarden Secrets ManagerÚEnabledzToken env varzToken in envzToken validationz
Project IDz[dim](unset)[/dim]z
Server URLz:[dim]default (US Cloud, https://vault.bitwarden.com)[/dim]zOverride existingr    zCache TTL (s)rž   rŸ   zAuto-installr¡   Tz
bws binaryz (rU   z[yellow]not installed[/yellow]z=
  Run [cyan]hermes secrets bitwarden setup[/cyan] to enable.z
  [yellow]Enabled but uG    is not set â€” Hermes will skip BSM and warn on next startup.[/yellow]uC   
  [yellow]Enabled but no project_id â€” nothing to fetch.[/yellow])r#   r   r¸   r   rª   ri   r¨   r
   rg   rh   rf   rW   Ú_token_validation_statusr   Ú_ynr(   rY   rM   )r_   r-   rH   Úbw_cfgr�   rp   rj   re   r<   r[   Útoken_validationÚvalidation_messagesÚmessages   &            r"   rA   rA   ñ   sÒ  € Ü	‹€BÜ‹i€GÜ”[“]Ó#€FÜ�6—:‘:˜iÓ(Ó)€GØ—
‘
Ð-Ô/AÓB€IØ—‘˜L¨"Ó-€JÜ˜ Ó.€JÜ�J‰J�N‰N˜9 bÓ)×/Ñ/Ó1€EØ�[‰[¨Eˆ[Ó2€FÜ,DØ¨eô-LÑ)Ðä�wÐ ;Ø	”C˜“LÐ!Ø	˜)Ð$Ø	œœT %›[Ó)Ð*Ø	Ð-Ð.Ø	�z×9Ð9Ð%9Ð:Ø	�z×aÐaÐ%aÐbØ	œc¤$ v§z¡zÐ2EÀuÓ'MÓ"NÓOÐPØ	œ#˜fŸj™jÐ)<¸cÓBÓCÐDØ	œœT &§*¡*¨^¸TÓ"BÓCÓDÐEØ	¿v˜&˜ ¤L°Ó$8Ð#9¸Ñ;ÐKkÐlð>ô ó 'ˆØ�‰�gÖñ 'çØ�‰ÐVÔWÙßØ�‰Ð0°°ð <;ð ;ô 	<çØ�‰Ð\Ô]Ùr$   c               ó    € V ^8„  d   QhRRRR/# r‘   r)   )r*   s   "r"   r+   r+     s   € ÷ 2ñ 2Ð&ð 2¨3ñ 2r$   c                ó`  a aaaa€ \        4       o\        4       o\        \        4       4      oSP	                  R\
        4      p\        SR4      oR V VVVV3R llp\        SS P                  TRRRV R2T\        \        SP                  SP	                  R	4      '       d   R
R7      # RR7      # )zËRotate the BSM access token without re-running the whole setup wizard: probe Bitwarden
with the new token (unless ``--no-verify``) and only then persist it, so a bad paste never
bricks the working token.r•   re   c               ó    € V ^8„  d   QhRRRR/# )r&   r<   r(   r3   rª   r)   )r*   s   "r"   r+   Úcmd_token.<locals>.__annotate__   s   € ÷ ñ �cð ˜dñ r$   c                ó‚  <€ V P                  R 4      '       g   SP                  \        4       SP                  '       d   R# SP	                  RR7      pVf   SP                  R4       R# SP                  R4       \        WSS	R7      pVf   SP                  R4       R# SP                  R\        V4       R	\        V4      ^8w  d   R
MR R24       \        SP                  RR4      ;'       g    R4      pV'       d:   V'       d2   Y2 Uu0 uF  qDR,          kK  	  up9  d   SP                  RV R24       R# u upi )rt   TrR   u`   [red]bws binary not available â€” cannot verify.  Re-run with --no-verify to store anyway.[/red]Fu   Verifying against Bitwardenâ€¦rz   u>   [red]âœ— New token was rejected â€” nothing was changed.[/red]u#   [green]âœ“ Token accepted[/green] (z projectÚsrb   z
 visible).rj   r„   z$[yellow]Warning: configured project z£ is not visible to this machine account.  Grant it access in the Bitwarden web app or re-run `hermes secrets bitwarden setup` to pick a different project.[/yellow])	ru   rM   Ú_NOT_BSM_TOKEN_WARNINGÚ	no_verifyrW   rŠ   rŒ   r(   ri   )
r<   r[   r�   rj   r‡   r_   r-   rÀ   rH   re   s
   &    €€€€€r"   ÚverifyÚcmd_token.<locals>.verify   s*  ø€ Ø×Ñ ×%Ò%Ø�M‰MÔ0Ô1Ø�>�>ˆ>ÙØ—‘°�Ó5ˆØŠ>Ø�M‰Mð Kô LáØ�‰Ð6Ô7Ü! &°ÀZÔPˆØÒØ�M‰MÐZÔ[ÙØ�‰ð Ü˜h›-˜¨¼¸H»ÈÔ8J±ÐPRÐ0SÐS]ð_ô 	`ä˜Ÿ™ L°"Ó5×;Ð;¸Ó<ˆ
ßŸ( zÈ8Ó9TÉ8Àa¸D¿'¸'É8Ñ9TÔ'TØ�M‰MØ6°z°lð Cgð gôhñ ùò :Us   ÄD<r9   u‘   Create a new token in the Bitwarden web app:
  Secrets Manager â†’ Machine accounts â†’ [your account] â†’ Access tokens â†’ Create access token
zPaste new access token (rs   r�   Nu§   [yellow]Note: the Bitwarden integration is currently disabled â€” run `hermes secrets bitwarden setup` (or set secrets.bitwarden.enabled: true) to turn it on.[/yellow])r   ÚintroÚpromptrÌ   ÚsaveÚenv_pathÚclear_cachesÚdisabled_note)r#   r   r¸   r   ri   r¨   r
   r   rd   r   r   rÒ   )r_   rp   rÌ   r-   rÀ   rH   re   s   f  @@@@r"   rB   rB     s¨   ü€ ô 
‹€BÜ‹i€GÜ”[“]Ó#€FØ—
‘
Ð-Ô/AÓB€IÜ˜ Ó.€J÷ô ô2 Ø�×"Ñ" IØð6ð *¨)¨°CÐ8ØÜ¤lÀÇÁØ$Ÿj™j¨×3Ò3�dôð ðGôð r$   c               ó    € V ^8„  d   QhRRRR/# r‘   r)   )r*   s   "r"   r+   r+   K  s   € ÷ 0ñ 0Ð%ð 0¨#ñ 0r$   c           	     óø  € \        4       p\        4       p\        \        4       4      p\	        W#R R4      '       g   ^# VP                  R\        4      p\        P                  P                  VR4      P                  4       pV'       g   VP                  RV R24       ^# VP                  RR4      pV'       g   VP                  R4       ^#  VP                  WVR\        VR	4      R
7      w  rxT'       g   TP                  R4       ^ # \        TP                  RR4      4      ;'       g    T P                  p
. p^ p\!        T4       F´  p\        \        P                  P                  T4      4      pYÔ8X  d   RpMnT'       d   T
'       g   RpM[T P                  '       d7   Y},          \        P                  T&   T^,          pRT'       d   RMR,           pMRT'       d   RMR,           pTP#                  Yß34       K¶  	  \%        TRRR/3R3Y¸4       T P                  '       g   TP                  R4       ^ # TP                  RT R24       ^ #   \         d!   p	TP                  RT	 R24        Rp	?	^# Rp	?	ii ; i)Ú	Bitwardenr   r•   rb   z[red]z is not set.[/red]rj   z$[red]No project_id configured.[/red]Fre   )rd   rj   r–   re   z[red]Fetch failed: rV   Nz'[yellow]No secrets in project.[/yellow]r    z![dim]skip (bootstrap token)[/dim]z[dim]skip (already set)[/dim]z[green]exported[/green]z (overrode)z[green]would export[/green]z (overrides)r   r|   r}   ÚActionuµ   
  This was a dry-run â€” secrets are picked up automatically on the next [cyan]hermes[/cyan] invocation.  Re-run with [cyan]--apply[/cyan] to export into the current shell instead.z
  [green]Exported z( secret(s) into current process.[/green])r#   r   r¸   r   r   ri   r¨   rg   rh   rf   rM   r«   r
   rZ   rª   Úapplyr¬   Úappendr   )r_   r-   rH   rÀ   rp   r<   rj   r”   r²   r\   ÚoverrideÚrowsÚappliedr›   ÚalreadyÚactions   &               r"   rC   rC   K  s  € Ü	‹€BÜ‹i€GÜ”[“]Ó#€FÜ˜7¨K¸×EÒEÙØ—
‘
Ð-Ô/AÓB€IÜ�J‰J�N‰N˜9 bÓ)×/Ñ/Ó1€EßØ�‰˜˜i˜[Ð(:Ð;Ô<ÙØ—‘˜L¨"Ó-€JßØ�‰Ð<Ô=ÙðØ×6Ñ6ØÀÔSZÐ[aÐcoÓSpð 7ó 
Ñˆ÷ Ø�‰Ð?Ô@ÙÜ�F—J‘JÐ2°EÓ:Ó;×IÐI¸t¿z¹z€HØ€DØ€GÜ�gŽˆÜ”r—z‘z—~‘~ cÓ*Ó+ˆØÔØ8‰FßŸXØ4‰FØ�Z�ZˆZØ%�lŒB�J‰J�s‰OØ�q�LˆGØ.Ç7±-ÐPRÕS‰Fà2Ï±nÐUWÕXˆFØ�‰�S�MÖ"ñ ô �˜6 G¨VÐ#4Ð5°xÐ@À$ÔQØ�:�:ˆ:Ø�‰ð Bô 	Cñ
 ð 	�‰Ð,¨W¨IÐ5]Ð^Ô_Ùøô; ô Ø�‰Ð+¨C¨5°Ð7Ô8Ýûðús   Ã I ÉI9ÉI4É4I9c               ó    € V ^8„  d   QhRRRR/# r‘   r)   )r*   s   "r"   r+   r+   ~  s   € ÷ %ñ %Ð(ð %¨Sñ %r$   c                ó   € \        R R4      # )r   uÃ   [green]Disabled.[/green]  Bitwarden secrets will NOT be pulled on the next Hermes invocation.
  Your access token is left in .env â€” remove it manually if you also want to revoke the credential.)r   )r_   s   &r"   rD   rD   ~  s   € Ü Øð	$ó%ð %r$   c               ó    € V ^8„  d   QhRRRR/# r‘   r)   )r*   s   "r"   r+   r+   ‡  s   € ÷ 	ñ 	Ð(ð 	¨Sñ 	r$   c                ó  € \        4       p\        4       p VP                  \        V P                  4      R 7      pVP                  RV R\        V4       R24       ^ #   \         d!   pTP                  RT R24        Rp?^# Rp?ii ; i))Úforceu   [green]âœ“[/green] rT   rU   z[red]Install failed: rV   N)r#   r   rX   rª   rã   rM   rY   rZ   )r_   r-   rH   Úpathr\   s   &    r"   rE   rE   ‡  s|   € Ü	‹€BÜ‹i€GðØ�~‰~¤D¨¯©Ó$4ˆ~Ó5ˆØ�‰Ð+¨D¨6°´\À$Ó5GÐ4HÈÐJÔKÙøÜô Ø�‰Ð-¨c¨U°&Ð9Ô:Ýûðús   –AA ÁB	Á)BÂB	re   rb   c          
     ó,   € V ^8„  d   QhRRRRRRRRRR	/# )
r&   r�   rª   r[   rP   r<   r(   re   r3   ztuple[str, list[str]]r)   )r*   s   "r"   r+   r+   –  s4   € ÷ -ñ -Øð-Ø,ð-Ø58ð-ØFIð-àñ-r$   c                óÎ  € V '       * R 3V'       * R3VRJ R33 F  w  rEV'       g   K  RV R2. 3u # 	  . pVP                  R4      '       g   VP                  \        4       \        \        P
                  ! 4       R^ÈR7      p\        WWsR	7      fS   VP                  R
R7      P                  4       pV'       d'   VP                  R VP                  4        4       4       RV3# RV3# )zintegration disabledztoken missingNzbws not installedz[dim]not checked[/dim] (rU   rt   T)ÚfileÚrecordr~   rz   F)Ústylesc              3  ó@   "  € T F  qP                  4       x € K  	  R # 5ir™   )Úrstrip)r…   Úlines   & r"   rˆ   Ú+_token_validation_status.<locals>.<genexpr>¤  s   é € ÐKÑ6J¨dŸK™KŸM˜MÓ6Jùs   ‚z[red]failed[/red]z[green]passed[/green])ru   rÙ   rv   r   ÚioÚStringIOrŠ   Úexport_textrf   ÚextendÚ
splitlines)	r�   r[   r<   re   ÚskippedÚreasonÚmessagesÚprobe_consoleÚdetailss	   $$$$     r"   r¾   r¾   –  sä   € ð ")œ[Ð*@ÐAÈÄIÈÐC_Ø# t˜^Ð-@ÐAóC‰ˆç‰7Ø-¨f¨X°QÐ7¸Ð;Ò;ñCð €HØ×Ñ˜D×!Ò!Ø�‰Ô9Ô:Ü¤§¢£°tÀ3ÔG€MÜ�f ]ÔJÒRØ×+Ñ+°5Ð+Ó9×?Ñ?ÓAˆßØ�O‰OÑK°g×6HÑ6HÔ6JÓKÔKØ" HÐ,Ð,Ø" HÐ,Ð,r$   c          
     ó,   € V ^8„  d   QhRRRRRRRRRR	/# )
r&   r[   r   r<   r(   rH   r   re   r3   zOptional[list[dict]]r)   )r*   s   "r"   r+   r+   ·  s;   € ÷ Dñ DØðDØðDØ'.ðDØ?BðDàñDr$   c               ó4  a€ \        4       pWR&   V'       d   W4R&    \        P                  ! \        V 4      RRRR.VRRRR	^R
R7      pTP                  ^ 8w  dÀ   TP                  ;'       g    TP                  P                  4       R,          pTP                  RT R24       TP                  4       o\         FY  w  r‰\        ;QJ d    T3R lT 4       F  '       g   K   RM	  R
M! T3R lT 4       4      '       g   KG  TP                  T	4        R# 	  R#  \        P                  ! TP                  ;'       g    R4      p
\#        T
\$        4      '       g   . # T
 Uu. uF6  p\#        T\&        4      '       g   K  TP)                  R4      '       g   K4  TNK8  	  up#   \        \        P
                  3 d!   pTP                  RT R24        Rp?R# Rp?ii ; i  \        P                    d!   pTP                  RT R24        Rp?R# Rp?ii ; iu upi )zICall ``bws project list`` and return the parsed list, or None on failure.r   rc   ÚprojectÚlistz--outputÚjsonTzutf-8ÚreplaceF)ÚenvÚcapture_outputÚtextÚencodingÚerrorsÚtimeoutÚcheckz  [red]Couldn't list projects: rV   N:Ni,  Nz   [red]bws project list failed: c              3  ó,   <"  € T F	  qS9   x € K  	  R # 5ir™   r)   )r…   rI   Úlowereds   & €r"   rˆ   Ú!_list_projects.<locals>.<genexpr>Ë  s   øé € Ð1© A˜–<«ùs   ƒz[]z  [red]bws returned non-JSON: r„   )r   Ú
subprocessÚrunr(   ÚOSErrorÚTimeoutExpiredrM   Ú
returncodeÚstderrÚstdoutrf   ÚlowerÚ_PROJECT_LIST_HINTSÚanyrü   ÚloadsÚJSONDecodeErrorÚ
isinstancerû   r¶   ri   )r[   r<   rH   re   rþ   Úresr\   ÚerrÚneedlesÚhintÚdatar‡   r  s   &&&$        @r"   rŠ   rŠ   ·  s¹  ø€ ô Ó
€CØ#ÐÑßØ *ÐÑðÜ�nŠnÜ�‹[˜) V¨Z¸Ð@Ø D¨t¸gÈiÐacÐkpôrˆð ‡~�~˜ÔØ�z‰z×'Ð'˜SŸZ™Z×.Ñ.Ó0°Õ6ˆØ�‰Ð8¸¸¸VÐDÔEØ—)‘)“+ˆß0‰MˆGß‹sÔ1©Ó1�s�sŠsÔ1©Ó1×1Ô1Ø—‘˜dÔ#ØÙñ	 1ñ ðÜ�zŠz˜#Ÿ*™*×,Ð,¨Ó-ˆô �dœD×!Ò!Øˆ	ÙÓC‘t�!œz¨!¬T×2ŒA°q·u±u¸T·{�AˆA‘tÑCÐCøô' ”Z×.Ñ.Ð/ô Ø�‰Ð7¸°u¸FÐCÔDÝûðûô ×Ñô Ø�‰Ð6°s°e¸6ÐBÔCÝûðüò
 DsG   �,F Ä"G Ä=G Å HÅ=HÆHÆGÆ:GÇGÇHÇ2HÈHc               ó(   € V ^8„  d   QhRRRRRRRR/# )	r&   r_   r`   r°   r¶   rH   r   r3   rq   r)   )r*   s   "r"   r+   r+   à  s,   € ÷ %ñ %Ø
ð%Ø+/ð%Ø:Að%àñ%r$   c                ó„  € V P                   '       d;   V P                   P                  4       '       d   V P                   P                  4       # \        P                  P	                  RR4      P                  4       pV'       d   VP                  RV R24       V# \        VR4      pV'       d   VP                  RV R24       \        RR	R
RR7      pVP                  RR^R7       VP                  R4       \        \        ^4       F#  w  pw  rxVP                  \        V4      V4       K%  	  \        \        4      ^,           p	VP                  \        V	4      R4       VP                  V4       RV	 R2V'       d   RMR,           p
\        W*R,           V	\        V4      RR7      pV^ 8X  d   V# V\        \        4      8:  d   \        V^,
          ,          ^,          # VP!                  R4      P                  4       pV'       g   VP                  R4       R
# VP#                  R4      '       g   VP                  R4       V# )zãPick a Bitwarden server URL: ``--server-url``, then ``BWS_SERVER_URL``, then the existing
``secrets.bitwarden.server_url``, then the interactive US / EU / self-hosted menu. None (after
printing) when a custom URL is left empty.rc   rb   z'  Detected [cyan]BWS_SERVER_URL[/cyan]=u    in your shell â€” using it.re   z  Existing config: [cyan]z?[/cyan]. Press Enter to keep, or pick a different option below.TÚboldN)Úshow_headerÚheader_styleÚboxÚpaddingr{   r}   )r|   r~   zRegion / endpointzSelf-hosted / custom URLz  Select region [1-Ú]z (Enter to keep current)z: z  [red]Enter a number.[/red])Úallow_emptyÚempty_messagezD  Enter your Bitwarden server URL (e.g. https://vault.example.com): z!  [red]Empty URL, aborting.[/red]u]     [yellow]Warning: URL doesn't start with http:// or https:// â€” bws may reject it.[/yellow])é    r&   )zhttp://zhttps://)re   rf   rg   rh   ri   rM   r
   r   Ú
add_columnr‹   Ú_REGION_PRESETSÚadd_rowr(   rŒ   r   rª   Úinputru   )r_   r°   rH   Úenv_urlÚexistingÚtabler†   ÚlabelÚ_urlÚ
custom_idxrÏ   rŽ   Úcustoms   &&&          r"   r©   r©   à  sÜ  € ð ‡‡€˜4Ÿ?™?×0Ñ0×2Ò2Ø�‰×$Ñ$Ó&Ð&Ü�j‰j�n‰nÐ-¨rÓ2×8Ñ8Ó:€GßØ�‰Ð?À¸yÐHdÐeÔfØˆÜ�{ LÓ1€HßØ�‰Ð1°(°ð <Oð Oô 	Pä˜d°¸TÈ6ÔR€EØ	×Ñ�S ¨aÐÔ0Ø	×ÑÐ(Ô)Ü%¤o°qÖ9Ñˆ‰=ˆEØ�‰”c˜!“f˜eÖ$ñ :ä”_Ó%¨Õ)€JØ	‡M�M”#�j“/Ð#=Ô>Ø‡M�M�%ÔØ" : ,¨aÐ0×RZÑ4NÐ`bÕc€FÜ
�w¨¥¨zÄtÈHÃ~Ø%CôE€Cà
ˆa„xØˆØ
Œc”/Ó"Ô"Ü˜s Q�wÕ'¨Õ*Ð*Ø�]‰]ÐaÓb×hÑhÓj€FßØ�‰Ð9Ô:ÙØ×ÑÐ4×5Ò5Ø�‰ÐuÔvØ€Mr$   )))Úinvalid_clientz400 bad requesta$    [yellow]'invalid_client' from the US identity endpoint usually means the token is for a different Bitwarden region.  Re-run [cyan]hermes secrets bitwarden setup[/cyan] and pick EU or self-hosted at the region prompt, or set [cyan]secrets.bitwarden.server_url[/cyan] in config.yaml.[/yellow]))ÚauthorizationÚinvalidzu  [yellow]This usually means the access token is wrong or revoked. Double-check it in the Bitwarden web app.[/yellow])u7   US Cloud  (https://vault.bitwarden.com â€” bws default)rb   )z&EU Cloud  (https://vault.bitwarden.eu)zhttps://vault.bitwarden.eu)DÚ__doc__Ú
__future__r   Úargparserî   rü   rg   r  r£   Úpathlibr   Útypingr   r   Úrich.consoler   Ú
rich.panelr   Ú
rich.tabler   Úhermes_cli._secrets_commonr	   r
   r   r   r   r   r   r   r   r   r   r   r   r   Úhermes_cli.configr   r   r   r   Úhermes_cli.secret_promptr   rY   r¿   r¨   rÊ   rv   r#   r0   rF   rN   r]   rn   rw   r�   r@   r¸   rš   rA   rB   rC   rD   rE   r¾   r  rŠ   r&  r©   r)   r$   r"   Ú<module>r>     s  ðÙ 8å "ã Û 	Û Û 	Û Û 
Ý ß !å  Ý Ý ÷÷ ÷ ÷ ÷
 UÓ TÝ 9ð €Ø€à'Ð ðCð ð
Wð "òõKõ"õ>5õ
õ Wõõ#õ"DõN)õ õ"õJ2õj0õf%õ	ð-ØLN÷-ð(
Ð ðDØEG÷DðH DØLð€÷%r$   