feat(dashboard): hermes dashboard register for self-hosted OAuth client - #38802
Merged
Conversation
…ient
Adds a CLI command that registers this install as a self-hosted dashboard
with the user's Nous Portal account, automating the manual browser flow on
/local-dashboards.
- New hermes_cli/dashboard_register.py: resolves a fresh Nous access token
from auth.json (fast-fails with a `hermes setup` hint when not logged in),
POSTs to {portal}/api/oauth/self-hosted-client, and writes
HERMES_DASHBOARD_OAUTH_CLIENT_ID into ~/.hermes/.env idempotently.
- Docker-style adjective_noun auto-naming; --name and --redirect-uri overrides.
- Persists HERMES_DASHBOARD_PORTAL_URL only when non-default and unset (so a
Vercel preview / staging portal sticks, prod default stays implicit).
- Refuses in managed/hosted installs (the orchestrator stamps the client_id).
- Post-register hint explains the OAuth gate only engages on a non-loopback bind.
- Nested 'register' subparser leaves bare `hermes dashboard` unchanged.
- 9 unit tests (name gen, fast-fails, POST shape, env writes, redirect URI,
portal-URL persistence, 401/403 mapping); dashboard lifecycle tests still green.
Depends on NousResearch/nous-account-service#324 (the portal endpoint).
…ride in register The register command resolved the portal base URL purely from the stored login, ignoring any override. That meant `HERMES_DASHBOARD_PORTAL_URL` (and the absence of any flag) gave no way to point registration at a staging or preview portal — the request always hit the login's portal, returning 404 against a branch that wasn't deployed there. - _resolve_portal_base_url now takes an optional override (precedence: override > stored login portal > prod default). - New --portal-url flag; falls back to HERMES_DASHBOARD_PORTAL_URL env. - Documents that the access token must be valid at the overridden portal (it's minted by whoever you logged into). - 3 new tests for override precedence. Verified live against the PR #324 Vercel preview: CLI -> preview endpoint -> real agent:{id} client_id written to .env.
Contributor
🔎 Lint report:
|
| Rule | Count |
|---|---|
unresolved-import |
1 |
invalid-argument-type |
1 |
First entries
tests/hermes_cli/test_dashboard_register.py:24: [unresolved-import] unresolved-import: Cannot resolve imported module `pytest`
tests/hermes_cli/test_dashboard_register.py:194: [invalid-argument-type] invalid-argument-type: Argument to `HTTPError.__init__` is incorrect: Expected `Message[str, str]`, found `None`
✅ Fixed issues: none
Unchanged: 5074 pre-existing issues carried over.
Diagnostics are surfaced as warnings — this check never fails the build.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Salvage of #38771 (@benbarclay) onto current
main. Addshermes dashboard register— registers this install as a self-hosted dashboard with the user's Nous Portal account and writes the resultingagent:{id}OAuth client ID into~/.hermes/.env, replacing the manual browser round-trip.Changes
hermes_cli/dashboard_register.py(new): token resolution (resolve_nous_access_token, auto-refresh) → POST{portal}/api/oauth/self-hosted-client→ idempotentsave_env_valueofHERMES_DASHBOARD_OAUTH_CLIENT_ID(+HERMES_DASHBOARD_PORTAL_URLon non-default portals). Docker-style auto-naming,--name/--redirect-uri/--portal-urlflags, managed-install refusal, 401/403 error mapping.hermes_cli/main.py: nestedregistersubparser — barehermes dashboardunchanged.tests/hermes_cli/test_dashboard_register.py(new): 12 unit tests.Validation
test_dashboard_register.pydashboard register --helphermes dashboardstill launches serverHERMES_DASHBOARD_OAUTH_CLIENT_ID+HERMES_DASHBOARD_PORTAL_URLread byplugins/dashboard_auth/nousPOST /api/oauth/self-hosted-client)Both contributor commits cherry-picked with @benbarclay's authorship preserved. Closes #38771.
Infographic