
    (GjK"                    :    d Z ddlmZ ddlZddlmZ ddZddZdS )ul  ``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. 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-buildzSkip 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
--isolatedzWhen 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/rurouni/.hermes/hermes-agent/hermes_cli/subcommands/dashboard.py_add_server_runtime_argsr      s[    sD/]     +,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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.T)r    no_opendashboard_subcommand)r   registerzVRegister a self-hosted dashboard with Nous Portal (writes the OAuth client ID to .env)zRegister 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_urizOptional 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_urlzOverride 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_parserr/   V   s
    ",,)g -  
 -...!!L/Q "    !! "   
 !!}!555 ((e	 )  L \*** Lx/@     =$??? ,::# ;   !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   r/    r   r   <module>r4      s     # " " " " "       C C C CLmH mH mH mH mH mHr   