Ë
    ÿ`gjî#  ã                  óD   — d Z ddlmZ ddlZddlmZ dd„Z	 	 	 	 	 	 dd„Zy)	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)ÚCallablec                ól  — | j                  dt        dd¬«       | j                  ddd¬«       | j                  d	d
d¬«       | j                  dd
d¬«       | j                  dd
d¬«       | j                  dddt        j                  ¬«       | j                  dd
d¬«       | j                  dd
d¬«       y)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    úS/root/.hermes/venv/lib/python3.12/site-packages/hermes_cli/subcommands/dashboard.pyÚ_add_server_runtime_argsr      s  € ð ×ÑØ”s DÐ/]ð ô ð ×ÑØ˜+Ð,Fð ô ð ×ÑØØðMð	 ô 	ð ×ÑØØðVð	 ô ð ×ÑØØðBð	 ô 	ð ×ÑØØØÜ×Ñð	 ô ð ×ÑØØØDð ô ð
 ×ÑØØØ@ð õ ó    c               óh  — | j                  ddd¬«      }t        |«       |j                  ddd¬«       |j                  d	dt        j                  ¬«       |j                  |¬
«       | j                  ddd¬«      }t        |«       |j                  ddt        j                  ¬«       |j                  |dd¬«       |j                  d¬«      }|j                  ddd¬«      }|j                  ddd¬«       |j                  dddd¬«       |j                  dddd¬«       |j                  |¬
«       y) 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.T)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--nameNzHHuman-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)Ú
subparsersÚcmd_dashboardÚcmd_dashboard_registerÚdashboard_parserÚserve_parserÚdashboard_subparsersÚdashboard_register_parsers          r   Úbuild_dashboard_parserr.   W   sŸ  € ð "×,Ñ,ØØ)Øgð -ó Ðô
 Ð-Ô.Ø×!Ñ!Ø˜LÐ/Qð "ô ð ×!Ñ!ØØÜ×Ñð "ô ð
 ×!Ñ! }Ð!Ô5ð ×(Ñ(ØØeðð	 )ó €Lô ˜\Ô*ð ×ÑØ˜L¬x×/@Ñ/@ð ô ð ×Ñ =¸$ÐQUÐÔVð ,×:Ñ:Ø#ð ;ó Ðð !5× ?Ñ ?ØØeðUð	 !@ó 	!Ðð ×*Ñ*ØØØWð +ô ð
 ×*Ñ*ØØØðUð +ô ð ×*Ñ*ØØØð8ð +ô 
ð ×*Ñ*Ð0FÐ*ÕGr   )ÚreturnÚNone)r(   r   r)   r   r/   r0   )Ú__doc__Ú
__future__r   r   Útypingr   r   r.   © r   r   ú<module>r5      sA   ðñõ #ã Ý óCðLqHØ"*ðqHØDLðqHà	ôqHr   