Commit c712a01f authored by Lisa (AI Assistant)'s avatar Lisa (AI Assistant)

Add README with documentation for installation, usage, and architecture

parent 41ef7b29
Pipeline #300 canceled with stages
# Hermes Node Chrome Extension
**Version:** 1.0
**Repository:** `git@git.nexlab.net:lisa/hermes-node-chrome.git`
Chrome extension that enables browser control capability for Hermes Node Agent. Provides DOM manipulation, screenshot capture, and click/type automation via content scripts and injected helpers.
---
## Features
- **DOM Manipulation**: Query, click, type, scroll
- **Screenshots**: Capture visible viewport or full page
- **Navigation**: Go to URLs, back, forward, reload
- **Tab Management**: Open, close, switch tabs
- **Manifest V3 Compatible**: Modern Chrome extension API
---
## Installation
### For Development
1. Clone this repository:
```bash
git clone git@git.nexlab.net:lisa/hermes-node-chrome.git
cd hermes-node-chrome
```
2. Open Chrome and navigate to `chrome://extensions/`
3. Enable **Developer mode** (toggle in top-right)
4. Click **Load unpacked**
5. Select the `hermes_browser_extension/` folder
6. The extension icon should appear in your toolbar
### For Production
Package the extension:
```bash
cd hermes_browser_extension
zip -r ../hermes-node-chrome.zip .
```
Upload `hermes-node-chrome.zip` to Chrome Web Store or distribute internally.
---
## Usage
The extension works in conjunction with the Hermes Node Agent:
1. Install the extension in Chrome
2. Install and configure the Hermes Node Agent with `enable_browser: true`
3. The agent communicates with the extension via native messaging
4. Commands are sent from the gateway → agent → extension
**Example commands:**
```python
# From Hermes Agent
hermes node my-node browser click "button#submit"
hermes node my-node browser screenshot
hermes node my-node browser navigate "https://example.com"
```
---
## Architecture
```
Gateway
↓ WebSocket
Node Agent (hermes_node_agent.py)
↓ Native Messaging
Chrome Extension
├── background.js # Service worker, message routing
├── content.js # Injected into pages, DOM access
├── injected.js # Runs in page context
└── manifest.json # Extension config
```
---
## Files
```
hermes_browser_extension/
├── manifest.json # Extension manifest (Manifest V3)
├── background.js # Service worker (message routing)
├── content.js # Content script (DOM manipulation)
└── injected.js # Injected script (page context)
```
---
## Protocol
The extension communicates with the node agent via Chrome's native messaging API.
**Message format:**
```json
{
"type": "browser_action",
"action": "click",
"params": {
"selector": "button#submit"
}
}
```
**Response format:**
```json
{
"success": true,
"result": { ... }
}
```
---
## Supported Actions
| Action | Description | Parameters |
|--------|-------------|------------|
| `click` | Click an element | `selector` |
| `type` | Type text into input | `selector`, `text` |
| `screenshot` | Capture screenshot | `full_page` (optional) |
| `navigate` | Go to URL | `url` |
| `query` | Query DOM elements | `selector` |
| `scroll` | Scroll page | `x`, `y` |
| `get_url` | Get current URL | none |
| `get_title` | Get page title | none |
---
## Permissions
The extension requires these permissions (declared in `manifest.json`):
- `activeTab` — Access current tab
- `scripting` — Inject scripts
- `tabs` — Tab management
- `nativeMessaging` — Communicate with node agent
---
## Security
- Extension only responds to messages from the authenticated node agent
- No external network requests
- Runs in isolated content script context
- Follows Chrome's security model
---
## Development
### Testing
1. Load the extension in Chrome (see Installation)
2. Open Chrome DevTools → Console
3. Check for extension logs
4. Test commands via the node agent
### Debugging
- **Background script logs**: `chrome://extensions/` → Extension details → Inspect views: service worker
- **Content script logs**: Open DevTools on the target page
- **Native messaging**: Check node agent logs
---
## Related Repositories
- **Node Agent:** `git@git.nexlab.net:lisa/hermes-node-agent.git`
- **Gateway:** (location TBD)
- **Plugin:** (location TBD)
---
## License
(Add license information)
---
## Support
For issues:
- Check Chrome extension console for errors
- Check node agent logs for native messaging errors
- Verify extension is loaded and enabled
- Ensure node agent has `enable_browser: true` in config
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment