# aev-bridge
Aev plugin bridge for phone-friendly terminal access.
`aev-bridge` does not spawn terminals. It proxies to `lios-web` (`aev-web`) and exposes a small mobile UI plus standard HTTP and Server-Sent Events. This keeps terminal ownership in one plugin and gives phones a browser-native stream protocol.
## Run
Start `lios-web` first and keep its token:
```bash
LIOS_WEB_TOKEN=replace-with-a-secret cargo run
```
Then start the bridge from this repo:
```bash
LIOS_WEB_TOKEN=replace-with-a-secret cargo run
```
Or install the published binary:
```bash
cargo install aev-bridge
```
The bridge binds to `0.0.0.0:8780` by default so a phone on the same LAN can open the printed URL. Set `AEV_BRIDGE_TOKEN` if you want a stable phone token.
## Protocol
- `GET /health` is public bridge health.
- `GET /api/manifest` returns the `aev-bridge` plugin manifest.
- `GET /api/upstream/health` checks `lios-web`.
- `POST /api/sessions` proxies session creation to `lios-web`.
- `GET /api/sessions/{id}/events` streams output as SSE.
- `POST /api/sessions/{id}/input` proxies terminal input.
- `DELETE /api/sessions/{id}` terminates the upstream session.
Fetch APIs use `Authorization: Bearer <bridge-token>`. The SSE endpoint also accepts `?token=<bridge-token>` because browser `EventSource` cannot set authorization headers.
## Register With Aev
The current Aev plugin board validates descriptors; it does not load plugin code yet. Register the descriptor with:
```text
/plugins add aev-bridge git https://github.com/Tknott95/AevBridge.git aev_plugin_init tool,bridge,mobile,http,sse,bearer-auth
/plugins validate all
```
See `examples/plugins.json` for the equivalent `.aev/plugins.json` entry.
## Security Notes
- LAN binding gives phone access; keep the bridge token private.
- Use `--bind 127.0.0.1:8780` if you only need local browser access.
- `LIOS_WEB_TOKEN` is the upstream terminal token and should not be shared beyond this bridge.