## Architecture

The panel is a pure HTTP client of the local **Hermes Gateway** (`127.0.0.1:8642`). For media it talks to the local **media bridge** (`8643`), and for browser use it drives the **browser-use hub** (`8645`).
### Drive your real browser (MCP)
The extension exposes **in-browser browser use** to the agent: through `browser-mcp.py` β an MCP server Hermes connects to β the agent can **see and operate your actual open tabs** (your real profile, cookies, and logins): snapshots with element refs, click/type/fill/navigate/scroll, screenshots, console & network logs, even file uploads. You can watch it drive the page live in the side panel, or let it attach tabs on its own and auto-release them when done. Full details below in [Browser use β live-browser bridge](#browser-use--live-browser-bridge-b1b4).
## Features
| Feature | Status |
|---------|--------|
| Side panel chat UI (ChatGPT-clean) | β
|
| Paste gateway URL + API key | β
|
| Create session on first message | β
|
| **`+` creates the session server-side immediately** | β
|
| Stream replies via SSE | β
|
| Markdown rendering (marked + DOMPurify) | β
|
| LaTeX math (KaTeX: `$β¦$`, `$$β¦$$`, `\(β¦\)`, `\[β¦\]`) | β
|
| Local media (`IMAGE:` / `MEDIA:` / `@image:` / `@media:` lines; img/audio/video) | β
|
| Image paste + click-to-preview + downscale (`@image:data:β¦`) | β
|
| `@url:` link attachments | β
|
| Media bridge (local files, zero browser config) | β
|
| Version badge in footer | β
|
| Live updates from other clients (~3 s polling) | β
|
| Session list + switch | β
|
| Load message history | β
|
| New chat | β
|
| Model picker | β
|
| Live-browser MCP bridge (drive your real tabs) | β
B1βB4 |
| Themes / more tools | β later |
Only **4 gateway endpoints** are used:
1. `POST /api/sessions` β create
2. `POST /api/sessions/{id}/chat/stream` β SSE stream
3. `GET /api/sessions/{id}/messages` β history
4. `GET /api/sessions` β list
Plus `GET /v1/health` for the connection test.
## Prerequisites
1. **Hermes Agent** installed and gateway running:
```bat
hermes gateway status
```
API server must be on (default `http://127.0.0.1:8642`).
2. **API key** from either:
- `~/.hermes/.env` β `API_SERVER_KEY=β¦`
- or `config.yaml` top-level `api_server.key`
(there is a second `platforms.api_server` block that is usually `enabled: false` β ignore it)
## Install (Chrome / Edge)
1. Make sure the Hermes gateway is up:
```bat
hermes gateway status
hermes gateway start
```
2. Open `chrome://extensions` (or `edge://extensions`)
3. Enable **Developer mode**
4. **Load unpacked** β select this folder
5. Pin **Hermes Extension**, click the icon (or `Alt+H`)
6. **Local media**: Edge cannot load `file://` subresources from extension pages β even with "Allow access to file URLs" on (Chrome tolerates it, Edge does not). The reliable path is the **media bridge** in step 7; the toggle is no longer required for images.
7. **Media bridge (recommended, zero browser config):** double-click `media-bridge.bat` (keep the console window open; Python 3 required) β the panel probes `http://127.0.0.1:8643` at boot and serves local media through it directly. See "Media bridge" below.
8. Get your API key β on Windows, double-click `Copy_API_Key.cmd` β paste into Settings β **Test connection** β **Save**
## Layout (no build)
```
manifest.json MV3 β sidePanel + storage + debugger + tabs + alarms
background.js sidePanel behavior + WS client + chrome.debugger relay + tabs control
sidepanel.html shell (+ browser chip/panel, quick menu)
sidepanel.css light ChatGPT-like theme + markdown styles
sidepanel.js client: SSE parser, rendering pipeline, polling, paste (+ browser UI)
renderer.js pure markdown/media/math extraction (node-testable)
test_renderer.js unit tests β run: node test_renderer.js
test_browser_mcp.py browser-mcp unit tests β run: py -3.14 -B test_browser_mcp.py
browser-mcp.py browser-use hub: MCP stdio server + WS listener on 8645 (B1βB4 tools)
media-bridge.py optional local media server (127.0.0.1:8643, stdlib-only)
media-bridge.bat launcher for media-bridge.py
PROTOCOL.md live-browser bridge wire protocol (B1βB4)
vendor/ pinned: marked 12.0.2, DOMPurify 3.1.6, KaTeX 0.16.11 (+ fonts)
icons/ 16/32/48/128
docs/ screen-recording.gif, architecture.svg (README images)
Copy_API_Key.cmd copies API_SERVER_KEY to clipboard
README.md
```
## How the gateway works (short)
Hermes ships a plain **HTTP REST + SSE** server. The extension is only an HTTP client.
**Auth:** `Authorization: Bearer