feat(browser): loopback extension pairing with scoped tokens - #88203
Open
abundantbeing wants to merge 1 commit into
Open
feat(browser): loopback extension pairing with scoped tokens#88203abundantbeing wants to merge 1 commit into
abundantbeing wants to merge 1 commit into
Conversation
Contributor
Author
abundantbeing
force-pushed
the
feat/browser-extension-pairing
branch
from
August 19, 2026 15:11
145dd23 to
f4a88cd
Compare
Contributor
Author
|
CI note for the maintainers: the failing slice on this head is unrelated to this PR's diff and reproduces on clean
A CI re-run (maintainer-only; the fork token gets 403 on |
abundantbeing
force-pushed
the
feat/browser-extension-pairing
branch
from
August 19, 2026 16:09
f4a88cd to
1f48654
Compare
10 tasks
abundantbeing
force-pushed
the
feat/browser-extension-pairing
branch
from
August 20, 2026 00:45
1f48654 to
e7bb6f4
Compare
abundantbeing
force-pushed
the
feat/browser-extension-pairing
branch
from
August 20, 2026 07:42
e7bb6f4 to
78040d1
Compare
Add the Hermes Browser extension pairing flow so any local extension can obtain a scoped bearer token with one approval click: - gateway/browser_pairing.py: BrowserPairingStore — persistent pending pairings + scoped tokens (HERMES_HOME/state/browser_pairing.json), 180s pairing TTL, 365-day token max age, prune on load/save. - gateway/platforms/api_server.py: five loopback-only pair endpoints (start / approve / grant / deny / status), scoped-token acceptance in the API-server auth check for the default profile only, browserPairing capability advertisement, and a Nous Portal-branded approval page (assets shipped under gateway/assets/browser_pairing/ with graceful fallback when missing). - tests/gateway/test_browser_pairing.py: store lifecycle + HTTP handler coverage, including the #approveButton/#denyButton DOM contract. - docs/browser-extension-pairing.md: flow, endpoints, token semantics, and the extension contract. The approval page keeps the stable DOM contract used by the extension's pairing e2e tests (button ids + form POST actions).
abundantbeing
force-pushed
the
feat/browser-extension-pairing
branch
from
August 21, 2026 19:29
78040d1 to
8ccf506
Compare
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 does this PR do?
Adds the loopback browser-extension pairing flow so the Hermes Browser extension can obtain a scoped bearer token with one approval click — the gateway half of the extension's "Connect to Hermes" flow.
gateway/browser_pairing.py(new):BrowserPairingStore— persistent pending pairings + scoped tokens underHERMES_HOME/state/browser_pairing.json, 180s pairing TTL, 365-day token max age, pruning on load/save, atomic file replace.gateway/platforms/api_server.py: five loopback-only endpoints (start,approve,grant,deny,status), scoped-token acceptance in the API-server auth check (default profile only — a named profile can never be reached with a token minted against the listener key),browserPairingcapability advertisement, and a Nous Portal-branded approval page whose assets ship undergateway/assets/browser_pairing/with graceful fallback to fallback fonts/no artwork when missing.tests/gateway/test_browser_pairing.py: 26 tests covering store lifecycle (create/get/grant/deny/expiry/prune/persistence/token validation), the HTTP handlers, loopback enforcement, the scoped-token auth hook, and the#approveButton/#denyButtonDOM contract.docs/browser-extension-pairing.md: flow diagram, endpoint table, token semantics, extension contract.The approval page keeps the stable DOM contract used by the extension's pairing e2e tests (button ids + form POST actions unchanged).
Related Issue
No issue filed — this is the gateway companion to the Hermes Browser extension's existing pairing client (extension repo, separate). It complements the authenticated browser-controller work in #85351 but is independently mergeable.
Type of Change
Changes Made
gateway/browser_pairing.py— newBrowserPairingStoremodule (161 lines)gateway/platforms/api_server.py— +343 lines: pairing routes, handlers, auth hook, capability advertisement, branded page (assets loaded fromgateway/assets/browser_pairing/at request time)gateway/assets/browser_pairing/— fonts (Sigurd + JetBrains Mono subsets), dithered statue artwork, badge, globe, wordmark (shipped via existinggateway = ["assets/**/*"]package-data)tests/gateway/test_browser_pairing.py— new test file (26 tests)docs/browser-extension-pairing.md— new docHow to Test
curl -X POST http://127.0.0.1:8642/api/browser-extension/pair/start -H "Content-Type: application/json" -d '{"name":"Hermes Browser Extension"}'→ returnspairing_id+approval_urlapproval_urlin a local browser → branded approve page with#approveButton/#denyButtonGET /api/browser-extension/pair/status/{pairing_id}returns{"status":"approved","token":"..."}Authorization: Bearer <token>against/v1/modelson the default profile → 200POST /api/browser-extension/pair/deny/{pairing_id}→ status returns 410pairing_deniedChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/A (no config keys added)CONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
The approval page renders pixel-identical to the locally approved design (verified via headless Chrome against a throwaway server serving this branch's code). Assets degrade gracefully when the
gateway/assets/browser_pairing/directory is absent.