§
    øžyjž%  ã                  ó:   — d Z ddlmZ ddlZddlmZ dd„Zdd„ZdS )uÜ  ``hermes dashboard`` / ``hermes serve`` subcommand parsers.

``dashboard`` is the browser web UI; ``serve`` is the same gateway, headless â€”
what the desktop app and remote backends run. ``serve`` also skips the web UI
build (``headless_backend=True``): pure JSON-RPC/WS clients never load the SPA.
Both share one handler (``cmd_dashboard`` â†’ ``start_server``). Extracted from
``hermes_cli/main.py:main()`` (god-file Phase 2); handler injected to avoid
importing ``main``.
é    )ÚannotationsN)ÚCallableÚreturnÚNonec                ó¨  — |                       dt          dd¬¦  «         |                       ddd¬¦  «         |                       d	d
d¬¦  «         |                       dd
d¬¦  «         |                       dd
d¬¦  «         |                       dddt          j        ¬¦  «         |                       dd
d¬¦  «         |                       dd
d¬¦  «         dS )u¢  Attach the runtime flags shared by ``dashboard`` and ``serve``.

    Both subcommands boot the *same* ``web_server.start_server`` (the
    JSON-RPC/WebSocket gateway). ``dashboard`` opens a browser UI on top of
    it; ``serve`` is the headless backend the desktop app and remote clients
    connect to. The shared server logic lives in one place â€” only the
    browser-opening behavior and help framing differ.
    z--portiŸ#  z,Port (default 9119, 0 for auto-assign by OS))ÚtypeÚdefaultÚhelpz--hostz	127.0.0.1zHost (default 127.0.0.1)©r	   r
   z
--insecureÚ
store_trueu÷   DEPRECATED / NO-OP. Formerly bypassed auth on a non-loopback bind. As of the June 2026 hardening it no longer disables authentication â€” a public bind always requires an auth provider (password or OAuth). Bind 127.0.0.1 + tunnel to keep it local.©Úactionr
   z--skip-buildzÊSkip the web UI build step and serve the existing dist directly. Useful for non-interactive contexts (Windows Scheduled Tasks, CI) where npm may not be available. Pre-build with: cd web && npm run buildz
--isolatedzøWhen launched from a named profile, run a dedicated server scoped to that profile instead of routing to the machine-level server. Default behavior is unified: profile launches attach to (or start) ONE machine-level server and preselect the profile.z--open-profileÚopen_profileÚ ©Údestr	   r
   z--stopz5Stop all running Hermes web server processes and exitz--statusz1List running Hermes web server processes and exitN)Úadd_argumentÚintÚargparseÚSUPPRESS)Úparsers    úF/home/ragecks/.hermes/hermes-agent/hermes_cli/subcommands/dashboard.pyÚ_add_server_runtime_argsr      s[  € ð ×ÒØ•s DÐ/]ð ñ ô ð ð ×ÒØ˜+Ð,Fð ñ ô ð ð ×ÒØØðMð	 ñ 	ô 	ð 	ð ×ÒØØðVð	 ñ ô ð ð ×ÒØØðBð	 ñ 	ô 	ð 	ð ×ÒØØØÝÔð	 ñ ô ð ð ×ÒØØØDð ñ ô ð ð
 ×ÒØØØ@ð ñ ô ð ð ð ó    Úcmd_dashboardr   Úcmd_dashboard_registerc               ó:  — |                       ddd¬¦  «        }t          |¦  «         |                     ddd¬¦  «         |                     d	dt          j        ¬¦  «         |                     |¬
¦  «         |                       ddd¬¦  «        }t          |¦  «         |                     ddt          j        ¬¦  «         |                     ddddd¬¦  «         |                     ddddd¬¦  «         |                     |dd¬¦  «         |                     d¬¦  «        }|                      ddd¬¦  «        }|                     ddd ¬!¦  «         |                     d"d#dd$¬%¦  «         |                     d&d'dd(¬%¦  «         |                     |¬
¦  «         dS ))u  Attach the ``dashboard`` and ``serve`` subcommands.

    Both share the same backend (``cmd_dashboard`` â†’ ``start_server``).
    ``dashboard`` is the browser UI; ``serve`` is the headless backend used by
    the desktop app and remote clients. They are independent surfaces â€” neither
    "launches" the other â€” so the desktop app spawns ``serve``, never
    ``dashboard``.
    Ú	dashboardzStart the web UI dashboardzQLaunch the Hermes Agent web dashboard for managing config, API keys, and sessions)r
   Údescriptionz	--no-openr   z Don't open browser automaticallyr   z--tui)ÚfuncÚservezVStart the Hermes backend server (headless; powers the desktop app and remote backends)u–   Run the Hermes backend server â€” the JSON-RPC/WebSocket gateway the desktop app and remote clients connect to. Headless: it never opens a browser UI.z--ssh-session-token-fileÚssh_session_token_fileÚPATHNz3Read a one-shot Desktop SSH session token from PATH)r   Úmetavarr	   r
   z--ssh-owner-nonceÚssh_owner_nonceÚNONCEz,Identify a Desktop-owned SSH backend processT)r    Úno_openÚheadless_backendÚdashboard_subcommand)r   ÚregisterzVRegister a self-hosted dashboard with Nous Portal (writes the OAuth client ID to .env)z÷Register this install as a self-hosted dashboard with your Nous Portal account. Creates an OAuth client, writes HERMES_DASHBOARD_OAUTH_CLIENT_ID into ~/.hermes/.env, and prints how to engage the login gate. Requires being logged in (hermes setup).z--namezHHuman-readable label for the dashboard (default: an auto-generated name)r   z--redirect-uriÚredirect_uriz‡Optional public HTTPS OAuth redirect URI for the dashboard, e.g. https://hermes.example.com/auth/callback. Omit for localhost-only use.r   z--portal-urlÚ
portal_urlzìOverride the Nous Portal base URL for registration (default: the portal you logged into). The access token must be valid at this portal. Also settable via HERMES_DASHBOARD_PORTAL_URL. Mainly for testing against a staging/preview portal.)Ú
add_parserr   r   r   r   Úset_defaultsÚadd_subparsers)Ú
subparsersr   r   Údashboard_parserÚserve_parserÚdashboard_subparsersÚdashboard_register_parsers          r   Úbuild_dashboard_parserr5   W   si  € ð "×,Ò,ØØ)Øgð -ñ ô Ðõ
 Ð-Ñ.Ô.Ð.Ø×!Ò!Ø˜LÐ/Qð "ñ ô ð ð ×!Ò!ØØÝÔð "ñ ô ð ð
 ×!Ò! }Ð!Ñ5Ô5Ð5ð ×(Ò(ØØeðð	 )ñ ô €Lõ ˜\Ñ*Ô*Ð*ð ×ÒØ˜L­xÔ/@ð ñ ô ð ð ×ÒØ"Ø%ØØØBð ñ ô ð ð ×ÒØØØØØ;ð ñ ô ð ð ×Ò =¸$ÐQUÐÑVÔVÐVð ,×:Ò:Ø#ð ;ñ ô Ðð !5× ?Ò ?ØØeðUð	 !@ñ 	!ô 	!Ðð ×*Ò*ØØØWð +ñ ô ð ð
 ×*Ò*ØØØðUð +ñ ô ð ð ×*Ò*ØØØð8ð +ñ 
ô 
ð 
ð ×*Ò*Ð0FÐ*ÑGÔGÐGÐGÐGr   )r   r   )r   r   r   r   r   r   )Ú__doc__Ú
__future__r   r   Útypingr   r   r5   © r   r   ú<module>r:      s�   ððð ð #Ð "Ð "Ð "Ð "Ð "à €€€Ø Ð Ð Ð Ð Ð ðCð Cð Cð CðLHð Hð Hð Hð Hð Hr   