# Sign-in and cloud configuration

Adom Bridge connects your Windows PC to your cloud containers so an AI in a
container can work with your machine. The fastest way to set that up is your
Adom account: sign in once, and your registered containers appear in Adom
Desktop automatically. No JSON, no copied URLs, no manual configuration.

![The Connections panel with signed-in servers](main-view.png)

This page explains what you will see during sign-in, how your containers show
up on their own, and what the AI in your container runs on its side.

## Signing in

Open Adom Bridge. If you are not signed in, the Connections panel shows a
prominent "Sign in to Adom" button (there is also a sign-in link in the
footer). Click it. Here is what happens:

1. Your default browser opens on the Adom approval page.
2. You approve the sign-in there, using your Adom account.
3. Adom Bridge waits in the background (it polls for up to 15 minutes) and
   picks up the session the moment you finish in the browser.

Your session is saved locally at `~/.adom/session.json`, so you stay signed in
across restarts.

On a fresh launch when you are signed out, Adom Bridge helps you along: it
shows a short countdown ("Logging you into Adom in 5, 4, 3, 2, 1", with a
Cancel button) and then opens the sign-in page for you.

If something goes wrong in the browser (for example, you picked the wrong
account), Adom Bridge shows a banner in the window with a Retry button. A
common cause is choosing a personal account instead of your Adom account, so
pick the right one and retry.

## The zero-JSON promise

Once you are signed in, Adom Bridge pulls the list of containers registered
to your Adom account and adds them to your Connections list by itself:

- Right after you sign in: your containers appear immediately and Adom
  Desktop connects to them right away. You should see the connection light go
  green within seconds.
- On every launch while you are signed in: Adom Bridge re-reads your account
  at boot, so a container registered yesterday shows up today without any
  action from you.

Because the registration lives in your account (not on any one machine), it
survives reinstalls and follows you to a new PC: install Adom Bridge, sign
in, and your containers are back.

## How a container gets into your account

You do not add containers by hand. The AI running inside your Adom cloud
container registers itself, using a one-line command that writes the
connection into your account. After that, the flow on your side is just:

1. Install Adom Bridge on Windows (from
   `https://wiki.adom.inc/adom/adom-bridge`).
2. Sign in with your Adom account.
3. The container appears in your Connections list and connects automatically.

If Adom Bridge was already installed and signed in when the container
registered itself, restart it (or wait for the next launch, which re-reads
your account) to see the new entry.

## For the AI in your container

If you are the AI setting up the connection, run the one-command setup first:

```bash
adom-bridge-cli setup_desktop
```

(Aliases: `setup`, `connect`.) It auto-detects this container's public relay
URL and returns a ready-to-run `register_command`, plus a fallback
`server_config` JSON and the installer URL. Run the `register_command`; it is
`register_container` with the name and URL filled in:

```bash
adom-bridge-cli register_container '{"name":"my-container","url":"wss://<container-slug>.adom.cloud/proxy/8765/"}'
```

`register_container` authenticates with the account token that Adom mounts at
`/var/run/adom/api-key` and writes the connection into the user's cloud
profile (the `desktop.container.<id>`, `desktop.last_slug`, and
`desktop.enabled` settings). It only works on Adom cloud containers; anywhere
else it returns `ok:false` with an explanation. It is idempotent by URL:
registering the same URL again refreshes the existing entry instead of
creating a duplicate, so call it once per container.

Keep the relay running so the desktop has something to connect to, then
verify:

```bash
adom-bridge-cli serve --supervise
adom-bridge-cli targets
```

## Fallback: paste the server JSON

If the container is not an Adom cloud container (or you prefer not to sign
in), you can add the connection manually. The AI gives you the
`server_config` JSON from `setup_desktop`; paste it into the Connections
panel's "Paste server JSON to add" box and press Enter. The server appears
and connects, shown by a green dot. Use the JSON exactly as provided.

Note that each container has its own relay: a new container needs its own
entry, and entries from old containers will not work for it.

## Signing out

Use the Sign-out link in Adom Bridge. It clears the saved session at
`~/.adom/session.json`. After signing out, your account-registered containers
stop syncing until you sign in again. (Programmatic callers can do the same
with the `desktop_logout` verb.)
