EN·ES·DE·PT·FR
⌘K

Client Gateway & Pairing

The Client Gateway serves the AIDaemon Client Protocol to your own apps and paired devices. It listens on loopback only; phones and other computers reach it over an end-to-end encrypted peer-to-peer link, with no tunnel, open port or account.

Turning it on

The macOS and Windows downloads and first-run setup turn it on for you. By hand:

config.toml
[client_gateway]
enabled = true
# bind = "127.0.0.1"
# port = 8788
# public_url = "https://aidaemon.example.ts.net"   # your HTTPS tunnel, for pairing links

Or ask the agent to "enable the client gateway": manage_config does it in one approved step, then restarts. Any change to a client_gateway key needs the owner's approval.

KeyTypeDefaultDescription
enabledboolfalseServe the Client Gateway
bindstring"127.0.0.1"Listen address. Must be loopback: a non-loopback bind is refused.
portinteger8788Listen port
token_filestringnullWhere the local token's hash is kept. Empty: ~/.aidaemon/client-gateway-token.sha256.
retention_daysinteger7Resume window. A client further behind gets a snapshot.
max_eventsinteger100000Most events the resume log keeps
watch_risk_ceilingstring"medium"Highest risk a paired watch may approve; above it a watch may only deny
public_urlstringnullThe HTTPS address paired devices use, put in pairing links
app_dirstringnullDirectory of the app's web build, served at /client/v1/next/. The installer puts it in ~/.aidaemon/app-web. Empty: that installed build is served when present.

[client_gateway.remote]

KeyTypeDefaultDescription
enabledbooltrueRemote access over iroh, on whenever the gateway is
relaysarray[]Your own iroh-relay URLs. Empty: the project's relay, relay.aidaemon.ai, and its address lookup
web_appstring"https://app.aidaemon.ai"Where a phone with no app pairs from a QR code: the project's web app or your own copy of the web build; "" for links that open the app only

[client_gateway.eink]

KeyTypeDefaultDescription
bridge_urlstringnullThe bridge e-ink readers reach this daemon through: "wss://bridge.aidaemon.ai/v1/daemon" or your own aidaemon-bridge (wss://; ws:// only on this computer). Empty: e-ink access is off. Settings → Connections → E-ink access sets it too.

Endpoints

  • /client/v1/ws — WebSocket
  • POST /client/v1/commands and long-poll GET /client/v1/events
  • /client/v1/next/ — the web app (/client/v1/app redirects there)

The current client protocol is 1.64. Clients resume from their last event without loss or duplicates. Challenge sign-in names the daemon it is meant for (1.51), so apps older than 0.23.0 need an update before signing in from another device by challenge.

The local token

Apps on the same machine sign in with the local token saved at ~/.aidaemon/client-token (owner-only), minted on first use. aidaemon client-token mints a new one and saves it there (the old token stops working at once); add --print to print it for scripts. Run aidaemon client-token, aidaemon pair and aidaemon web from ~/.aidaemon, the daemon's folder.

Pairing phones and browsers

The quickest way: in the desktop app, open Settings → Paired devices → Pair a phone. It shows a QR code for the phone's camera, a Send to my phone button (the system's share menu) and Copy link; you approve the phone right there. Or:

  1. Send /pair_device in a chat, or run aidaemon pair in a terminal (it shows a QR code). This makes a single-use code valid for ten minutes.
  2. Open the link on the device and tap Open AIDaemon. The link opens your daemon's own pairing page (/client/v1/pair), which hands the pairing to the app (or its store page), or pairs that browser instead. The pairing details ride after the #, which browsers never send to a server. Pasting the link into the app works too.
  3. Confirm in that chat or terminal. Pairing links always ask you to confirm and name the daemon.

A phone with no app opens the web app at https://app.aidaemon.ai (or your web_app), already paired, and reaches your daemon by its key through the relay. The phone keeps its key in the iOS keychain or Android's private app storage. An app the daemon refused, or that has not reached it for two minutes, offers Pair again.

Each paired device gets short-lived tokens carrying its scopes (observe, chat, approve, and control for live views). /devices lists devices and /revoke_device <id> ends a device's tokens, open connections and file links at once; Settings → Paired devices has Remove too. Only the computer itself, or a device that may answer every approval, can pair or remove devices, and no device removes itself.

E-ink readers

A Kindle, or another e-ink reader whose browser cannot run the app, reaches your daemon through a bridge. The daemon dials out to the bridge, so nothing on your computer is opened to the internet, and the bridge only relays frames encrypted end to end between the reader's browser and the daemon.

  1. Turn on Settings → Connections → E-ink access (AIDaemon's bridge, or your own). Turning it on is asked on another device.
  2. On the reader, open https://eink.aidaemon.ai and press Pair. It shows a code, a QR code and a 4-character check code.
  3. In the app, Settings → Paired devices → Pair an e-ink device and type the code; or scan the QR code with your phone and type the check code shown on the reader (never one from a message).

The reader can chat, see and steer coding sessions (typed, or handwritten on its screen), and answer agent approvals once. Set its level under Paired devices:

LevelWhat it may do
View onlyRead conversations, runs, changes and projects
LimitedChat and steer, with its runs held to Medium: a call that sends data out, deletes, changes configuration or credentials, or is rated High waits for a card on your phone or computer, in its background work and after a restart too
FullRuns follow your settings like any app message, and it may approve agent requests up to High once

At every level a reader keeps a fixed list of commands and never reaches a conversation's shell, settings, pairing, lasting grants or setup, and Critical cards always wait for a trusted device. At Full, and once you allow it, it can use your terminals in project folders, at most 4 of its own: see Terminals. Its browser is no longer updated, so a harmful site opened in it could act with its access: prefer Limited unless the reader is used for nothing else. Remove it under Paired devices and it loses access at once. To host the bridge and the page yourself, see deploy/.

Remote access over iroh

Remote access is on whenever the Client Gateway is. The daemon keeps a key of its own (~/.aidaemon/remote-key), and pairing links and QR codes carry its address. The app connects straight to your computer when the network allows, and through a relay otherwise: the project's relay.aidaemon.ai by default, or your own iroh-relay servers in relays. Traffic is end-to-end encrypted, so a relay sees your computer's address but never what it says.

  • Over this path a device may only pair and sign in until it has a session, a session works only from the device that signed in for it, and the owner's local token is refused.
  • Pictures and files, live views, terminals and aidaemon share-screen work over it too, through a local bridge in the app.
  • On the project's relay the daemon publishes which relay it is on to dns.aidaemon.ai (the relay URL only, signed with its key, never an IP address), so an app whose saved relay went stale still finds it. Self-hosted relays use neither.
  • [client_gateway.remote] enabled = false turns it off. The project's relay and lookup servers are set up as in deploy/.

Tunnels (optional)

You don't need a tunnel to reach AIDaemon. Use one only if you want the gateway at an address of your own. Let the daemon run the tunnel itself:

config.toml
[exposure.client_gateway]
adapter = "tailscale"        # private to your tailnet; mode = "funnel" makes it public

Adapters: tailscale (serve or funnel), cloudflare (named, or quick for a throwaway address), manual (the url of a reverse proxy you run) and command. cloudflared or tailscale must be on PATH, or named with binary = "...". Changes apply after a restart; /exposure shows each tunnel's state. An SSH tunnel to port 8788 also works.