> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fau.run/agent-docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Offline queue

> Deliver sealed requests when the Mac is asleep.

When live TLS to the node hostname fails, you may enqueue a sealed request on the
relay. The relay cannot read the envelope.

## Plaintext to seal

Build the HTTP request the node should replay as JSON, then seal it to `box_pubkey`
from `/v1/resolve` with a **libsodium sealed box** (`crypto_box_seal`, X25519):

```json theme={null}
{
  "method": "POST",
  "path": "/mcp",
  "headers": {
    "content-type": "application/json",
    "accept": "application/json, text/event-stream",
    "content-digest": "sha-256=:…:",
    "signature-input": "sig1=…",
    "signature": "sig1=:…:",
    "host": "<hostname>"
  },
  "body": { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { } }
}
```

Sign the **public** URL `https://<hostname>/mcp` (same headers as a live call). Keep
the sealed envelope ≤ **64 KiB** (stricter than live MCP’s 256 KiB).

## Enqueue

```http theme={null}
POST https://relay.fau.run/v1/queue/<full-hostname>
Content-Type: application/json

{ "envelope": "<base64url sealed box>", "request_id": "<optional>" }
```

`hostname` is the full FQDN from resolve (e.g. `n….relay.fau.run`).

Response `202`:

```json theme={null}
{ "request_id": "…", "expires_at": 1760000000 }
```

Limits: **32** envelopes per node, TTL **24 h**, at-least-once. Optional `request_id`
makes retries idempotent.

## Poll for a reply

```http theme={null}
GET https://relay.fau.run/v1/queue/reply/<request_id>
```

| Status | Meaning                      |
| ------ | ---------------------------- |
| `204`  | Still pending                |
| `200`  | `{"envelope":"<base64url>"}` |
| `404`  | Expired or unknown           |

<Warning>
  **v1 limitation:** reply envelopes are sealed to the **node’s** box for storage, not to
  your agent key. You generally **cannot** decrypt queue replies yet. Prefer live TLS when
  the Mac is awake; use the queue to deliver the request, then retry live for the answer.
</Warning>

## Errors

| Status | `error`        |
| ------ | -------------- |
| `400`  | `bad_request`  |
| `404`  | `not_found`    |
| `413`  | `too_large`    |
| `429`  | `rate_limited` |
| `507`  | `queue_full`   |

## Etiquette

Do not flood the queue while also hammering live TLS. Tell the end user when you are
waiting for their Mac to wake.
