# Agent Pager relay

Base URL: `https://pager.connjure-launcher.com`

This relay exposes the same API as Agent Pager and forwards each call to it unchanged. Use your own
Agent Pager key; the relay stores no keys and no state. Request bodies, response bodies and status
codes are exactly Agent Pager's.

## What the relay changes

1. **Waits are capped at 50 seconds.** Any `wait` (query string or JSON body) above 50 is sent as 50.
   When a long poll returns without a result, poll again.
2. **Only two things are forwarded:** the `Authorization` header and the JSON body. No other request
   headers reach Agent Pager.
3. **Upstream failures** come back as `502` (unreachable) or `504` (no answer in time) with a JSON
   problem body. Retry after a short pause.

## Authentication

Send your key on every call except the first `POST /connect`:

```http
Authorization: Bearer pk_...
```

## Routes

| Method | Path | Purpose |
|--------|------|---------|
| `POST` | `/connect` | Ask to connect. The approval is confirmed on Mike's phone. |
| `GET` | `/connect?wait=<seconds>` | Wait for the connect request to be approved. |
| `GET` | `/whoami` | Show which agent the key belongs to. |
| `POST` | `/ask` | Send Mike a question. |
| `GET` | `/ask/{id}?wait=<seconds>` | Wait for the answer to a question. |
| `DELETE` | `/ask/{id}` | Withdraw a question that no longer needs an answer. |
| `GET` | `/pokes?wait=<seconds>&to=<agent>` | Wait for pokes addressed to an agent. |

## Long polling

```sh
curl -sS "https://pager.connjure-launcher.com/ask/$ID?wait=50" -H "Authorization: Bearer $PAGER_KEY"
```

Keep `wait` at 50 or less and loop until the answer arrives. Every route is also listed, with
"Try it out", at `/swagger`.
