# Hermes Node Protocol
# Copyright (c) 2026 Stefy (nextime) Lanza <stefy@nexlab.net>
# All rights reserved.
# 
# This software is released under the MIT License with a copyleft clause.
# See the LICENSE file for full terms.
# Deploying Browser Control to sissy (Laptop)

## Architecture Recap

```
sissy (laptop) ←←← Node Agent ←←→ zeiss (workstation) ←→ Hermes
      ^                              ^
      └── Browser control runs HERE ─┘
```

The node agent runs **on sissy**, controlling the local browser.
Hermes talks to the **gateway on zeiss**, which routes to sissy.

---

## What's Already Done

✅ Code written: `browser_controller.py`, node agent integration, gateway HTTP endpoint
✅ Playwright + Chromium tested on lisa (this VPS)
✅ Gateway updated with sissy token and browser endpoint
✅ Install script prepared: `install-on-sissy.sh`
✅ Documentation: `BROWSER_CONTROL.md`, `SKILL.md`

---

## Step-by-Step Deployment

### On lisa (this VPS) — Package & Transfer

**1. Archive the node agent code:**

```bash
cd ~/hermes-node-protocol
tar -czf node-agent-package.tar.gz node-agent/ install-on-sissy.sh
```

**2. Transfer to sissy:**

Since you're on sissy writing to me, you already have access. Just copy the package:

From lisa, scp to sissy:
```bash
# Assuming you can SSH from lisa to sissy
scp node-agent-package.tar.gz nextime@sissy:/tmp/
```

Or simpler: just download it from lisa via your local browser on sissy if you have a web server running.

**Actually — since you're *on* sissy now, do this instead:**

On sissy, clone or copy from lisa:
```bash
# If hermes-node-protocol is already on sissy, skip this
# If not, copy from lisa (assuming SSH access from sissy to lisa):
scp lisa:~/hermes-node-protocol/node-agent ~/hermes-node-protocol/
scp lisa:~/hermes-node-protocol/install-on-sissy.sh ~/hermes-node-protocol/
```

**Where is the code on lisa?**
It's at: `/home/lisa/hermes-node-protocol/`

Since you're currently on **sissy**, and you have access to your files, you need to get this code onto sissy. How do you want to transfer it?

Options:
1. **Git repo** — if the code is in a git repo, just `git clone` on sissy
2. **SCP/rsync** — from sissy to lisa (reverse direction since lisa is the source)
3. **USB/external drive** — copy manually
4. **Shared filesystem** — NFS/SMB mount

Which do you prefer? Or is the code already on sissy?

---

### On sissy — Installation

Once the code is on sissy at `~/hermes-node-protocol/`:

```bash
cd ~/hermes-node-protocol
sudo ./install-on-sissy.sh
```

This will:
- Create `/etc/hermes-node/config.json`
- Setup Python venv + Playwright
- Install SysV init script
- Start the node agent

### On zeiss (gateway) — Verify

Node should auto-register with gateway on zeiss:

```bash
# On zeiss, check:
curl http://localhost:8766/nodes/sissy/status

# Should return:
# {"name":"sissy","status":"connected",...}
```

### From Hermes — Control sissy's browser

```python
# Example using curl
curl -X POST http://zeiss:8766/nodes/sissy/browser \
  -H "Content-Type: application/json" \
  -d '{
    "action": "launch",
    "params": {"config": {"headless": false}}
  }'
```

---

## Files to Transfer from lisa to sissy

```
hermes-node-protocol/
├── node-agent/
│   ├── hermes_node_agent.py       (main agent)
│   ├── browser_controller.py      (new)
│   ├── requirements.txt           (new)
│   ├── test_browser.py            (test script)
│   └── venv/                      (will be recreated on sissy)
├── gateway/
│   └── hermes_node_gateway.py      (already on zeiss, not needed on sissy)
├── install-on-sissy.sh             (new)
├── README.md
├── PROTOCOL.md
├── PROJECT_SUMMARY.md
├── DEPLOYMENT.md
└── BROWSER_CONTROL.md             (new)
```

Only `node-agent/` directory and `install-on-sissy.sh` are needed on sissy.

---

## Quick Transfer Command

From **sissy**, run:

```bash
# Copy from lisa (source) to sissy (current machine)
scp -r lisa:~/hermes-node-protocol/node-agent ~/hermes-node-protocol/
scp lisa:~/hermes-node-protocol/install-on-sissy.sh ~/hermes-node-protocol/
```

If SSH from sissy to lisa isn't set up, we'll need another method.

**Question:** Can sissy SSH into lisa? Or do you want a different transfer method?
