feat(dashboard): hermes dashboard register for self-hosted OAuth client - #38771
Closed
benbarclay wants to merge 2 commits into
Closed
feat(dashboard): hermes dashboard register for self-hosted OAuth client#38771benbarclay wants to merge 2 commits into
hermes dashboard register for self-hosted OAuth client#38771benbarclay wants to merge 2 commits into
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 |
|---|---|
invalid-argument-type |
1 |
unresolved-import |
1 |
First entries
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`
tests/hermes_cli/test_dashboard_register.py:24: [unresolved-import] unresolved-import: Cannot resolve imported module `pytest`
✅ Fixed issues: none
Unchanged: 5074 pre-existing issues carried over.
Diagnostics are surfaced as warnings — this check never fails the build.
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.
What
Adds
hermes dashboard register— a CLI command that registers this install as a self-hosted dashboard with the user's Nous Portal account and writes the resulting OAuth client ID into~/.hermes/.env.This is the CLI half of a two-lane feature. The NAS half (the portal endpoint it calls) is NousResearch/nous-account-service#324 and must merge + deploy first.
Why
Today a self-hosting user who wants Nous OAuth on their dashboard has to: open
portal.nousresearch.com/local-dashboardsin a browser → click register → copy theagent:{id}client ID → paste it into.envby hand. This command does that round trip from the terminal.How it works
auth.json(reusesresolve_nous_access_token, which auto-refreshes). Fast-fails with ahermes setuphint when not logged in.{portal}/api/oauth/self-hosted-client(the fix: key priority based on active endpoint, not fixed order #324 endpoint).HERMES_DASHBOARD_OAUTH_CLIENT_IDinto~/.hermes/.envidempotently (via the existingsave_env_value).Details:
adjective_noun, e.g.dreamy_tesla);--nameoverrides. No uniqueness constraint server-side (row id is the key), so no collision retry.--redirect-urifor users exposing a public HTTPS dashboard — forwarded to the portal's existingvalidateCustomRedirectUri.--portal-url/HERMES_DASHBOARD_PORTAL_URLoverride the request target (precedence: flag > env > stored login portal > prod default). The token must be valid at the overridden portal. Persists a non-default portal into.envso the dashboard's gate talks to the same portal at serve time.save_env_valuerefuses anyway.registersubparser leaves barehermes dashboardunchanged.Tests
Live E2E (verified)
Run against the #324 Vercel preview build with a real token:
/api/oauth/self-hosted-client→ returned a realagent:{cuid}client_id → written to.env. Full chain (auth → org resolution → row creation → env write) confirmed end-to-end, not just mocked.Lane / review
Touches
hermes_cli/main.py, so this needs review (not Docker-lane). Do not merge before #324 is deployed — the endpoint must exist.