# Zenki Edge Bridge

This host daemon now exposes a local HTTP bridge for browser-side integrations.

## Endpoints

- `GET http://127.0.0.1:8765/health`
- `POST http://127.0.0.1:8765/zenki`

## Start the daemon

```bash
cargo run --release -- --ws-port 9000 --api-port 8765
```

## Send a command

```bash
curl -s -X POST http://127.0.0.1:8765/zenki \
  -H 'Content-Type: application/json' \
  -d '{"command":"START_GAMING_FLOW"}'
```

## Supported commands

- `START_GAMING_FLOW`
- `BOOST_EDGE`

## Edge button example

Use this in your extension/service worker or injected UI handler:

```javascript
async function triggerZenki(command) {
  const res = await fetch('http://127.0.0.1:8765/zenki', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ command })
  });

  if (!res.ok) {
    const msg = await res.text();
    throw new Error(`Zenki bridge failed: ${msg}`);
  }

  return res.json();
}

// Hook this to your Copilot-side action/button
triggerZenki('BOOST_EDGE').catch(console.error);
```

## Notes

- The bridge binds only to `127.0.0.1` (local machine only).
- CORS is enabled for local browser calls.
- This does not replace Copilot. It gives Copilot-adjacent UI a local system action layer.
