# Bridge technical reference > Generated from https://bridgedesktop.com/docs/. Each section below is one page; its canonical URL is given under its title. --- # Bridge technical reference Source: https://bridgedesktop.com/docs/ > How Bridge installs, connects, updates and contains its agent. Written for operators, security reviewers and the coding agents they point at it. This is the reference for the parts of Bridge you run and secure yourself: the Linux install, the `bridgectl` command, self-hosting, how machines reach each other, how updates are verified, and what the agent can and cannot touch. The product guide in the app covers day-to-day use; this covers the machinery under it. Every statement here is about shipped code. Pages name the source files they describe, as paths in the Bridge repository, so they can be checked. ## Pages | page | covers | | --- | --- | | [Linux install](/docs/linux-install/) | The `install.sh` one-liner: every option, what it installs where, and the order it does it in | | [bridgectl](/docs/bridgectl/) | The command for managing a Linux install, command by command | | [Semantic search](/docs/semantic-search/) | Keyword and meaning search, why Linux ships without the second, and low-power machines | | [Self-hosting on Linux](/docs/self-hosting/) | Running your own Bridge with `--server`: services, ports, state, upgrades | | [Components and updates](/docs/components-and-updates/) | The signed release manifest, and how to verify a download yourself | | [Networking](/docs/networking/) | The tailnet, the relays, every port, and what is never exposed | | [Agent tools and containment](/docs/agent-tools/) | What the agent can run, where, and the limits on it | | [The Bridge API](/docs/api/) | Using your Bridge account from any code, and the project keys Bridge makes for the apps it builds | ## For coding agents Every page is also published as plain markdown at the same address with `.md` on the end, for example [/docs/bridgectl.md](/docs/bridgectl.md). Two indexes follow the llms.txt convention (llmstxt.org): - [/llms.txt](/llms.txt) lists every page with a one-line description. - [/llms-full.txt](/llms-full.txt) is every page concatenated, for reading in one fetch. ## Status The reference is public, like the rest of this site. The source lives in the Bridge repository under `site/docs/`, and changes in the same commit as the code it describes. --- # Linux install Source: https://bridgedesktop.com/docs/linux-install/ > The install.sh one-liner, every option it takes, what it installs where, and the order it does things in. A Linux machine joins an existing Bridge with one command. Bridge generates it for you from either of two places, and the key decides what the machine becomes: - **Add a device** (Settings > My machines) or **Add one of my devices** (Settings > Members), then **Installing on Linux?** on the key. The machine joins as one of your devices, the same as a laptop would. - **Add a machine** in a project's **Set up workspace** dialog. Keys from there are agent-only: the machine runs its owner's agent and nobody can sign in to Bridge from it (see step 7 below). ```bash curl -fsSL https://bridgedesktop.com/install.sh | sh -s -- inv_v2_... ``` With an invite key the script only ever joins the team the key came from. `--server` is the one option that creates a new team, and it refuses an invite. On a machine that is already on another Bridge, the same command adds this one beside it (see [More than one Bridge](#more-than-one-bridge)). Or it hosts a new Bridge of its own (see [Self-hosting](/docs/self-hosting/)): ```bash curl -fsSL https://bridgedesktop.com/install.sh | sh -s -- --server --owner dan ``` Source: `site/public/install.sh` in the Bridge repository; the script you download is that file, byte for byte. It is POSIX `sh`, so it runs under `dash` on a fresh Debian as well as `bash`. ## Requirements - Linux with systemd, on `x86_64` or `aarch64`. A Raspberry Pi running 64-bit Raspberry Pi OS is supported. - `curl` and `tar`. - Root. Run as a normal user and the script re-runs itself under `sudo`. - `--server` additionally needs glibc, because the Bun-compiled server links it. Debian, Ubuntu, Fedora and Raspberry Pi OS have it; Alpine does not. ## Options | option | effect | | --- | --- | | `` | Join the Bridge the invite came from. `inv_v2_...` (or the older `inv1_...`). The invite link, `'https://bridgedesktop.com/invite#inv_v2_...'`, works too; quote it, since an unquoted `#` starts a shell comment. Works once, expires after 24 hours. | | `--server` | Host a new Bridge on this machine instead of joining one. Takes no invite. | | `--owner NAME` | With `--server`, the Bridge's first user and owner. Lowercase letters, digits and dashes. Defaults to the user who ran `sudo`. Also accepted as `--owner=NAME`. | | `--semantic` | Also install meaning search (see [Semantic search](/docs/semantic-search/)). Skipped with a message on a low-power machine. | | `--semantic=force` | The same, on a low-power machine too. | | `--no-auto-update` | Install the daily update timer but leave it disabled. | | `--invite-file PATH` | Read the invite from a root-only file instead of the command line. Used by Bridge's cloud VM bootstrap; works for any install. | Unknown options are an error, not ignored. ## Environment overrides | variable | default | meaning | | --- | --- | --- | | `BRIDGE_HOST` | `https://bridgedesktop.com` | Where the tarball is downloaded from. | | `BRIDGE_PREFIX` | `/usr/local/bin` | Where the `bridge-agent` and `bridgectl` links go. | | `BRIDGE_LIB_DIR` | `/usr/local/lib/bridge` | Where the binaries go. | | `BRIDGE_STATE_DIR` | `/var/lib/bridge` | State: tailnet identity, `agent.env`, search index. | | `BRIDGE_SOCKS5` | `127.0.0.1:2640` | The tailnet's SOCKS5 proxy. | | `BRIDGE_SHIM_LISTEN` | `127.0.0.1:2620` | The control shim `tailscaled` logs in through. | | `BRIDGE_TUNNEL_LISTEN` | `127.0.0.1:2600` | The loopback tunnel to the server. | | `BRIDGE_INVITE`, `BRIDGE_SERVER`, `BRIDGE_OWNER`, `BRIDGE_SEMANTIC` | unset | The options above, as environment. This is how the script passes them through `sudo`, so an invite never appears on `sudo`'s command line. | | `BRIDGE_CLOUD_JOB`, `BRIDGE_CLOUD_CAPABILITY_FILE`, `BRIDGE_CLOUD_ARTIFACT_URL`, `BRIDGE_CLOUD_ARTIFACT_HASH` | unset | Set only by a Bridge-provisioned cloud VM. The installer then registers through `/api/cloud-machines/register` with a single-job capability instead of asking for the server-wide enrollment secret, and installs exactly the release the server verified (pinned SHA-256). Root only. | ## Cloud VMs created by Bridge When a cloud workspace is created from **Add a workspace** (DigitalOcean or Linode, in your own provider account), the server embeds this installer in the VM's cloud-init and runs it there. Differences from a hand-run install: - The VM gets a **machine-scoped reconnect credential**, never `AGENT_ENROLL_SECRET`. It is bound to that VM's tailnet node, and the server refuses it from any other node, from a fallback tailnet, or after the VM is disconnected or deleted. - Workspace files live on a **separate block volume** mounted at `/workspace`. The agent will not start unless that volume is mounted. - Inbound traffic is dropped by both a provider firewall and the guest's own rules. SSH is disabled; recovery is through the provider's console. ## What it installs The download is one tarball, `/download/linux-`, of static binaries: | file in `/usr/local/lib/bridge` | what it is | | --- | --- | | `bridge-agent` | The agent: runs tools on this machine for the Bridge it is enrolled with. Built without the semantic search engine. | | `tailscaled` | A userspace Tailscale daemon, with the `tailscale` CLI compiled into it. | | `tailscale` | A symlink to `tailscaled`; the name selects the CLI. Older releases shipped a separate binary. | | `bridge-tailnet` | Verifies the control plane, then fronts the server on loopback. | `/usr/local/bin/bridge-agent` and `/usr/local/bin/bridgectl` link to the agent binary. Run as `bridgectl`, it is the management CLI (see [bridgectl](/docs/bridgectl/)). systemd units in `/etc/systemd/system`: | unit | runs | | --- | --- | | `bridge-tailscaled.service` | `tailscaled --tun=userspace-networking --port=0 --socks5-server=127.0.0.1:2640 --no-logs-no-support` with its own state dir and socket. Nothing is uploaded to Tailscale's log service. | | `bridge-tailnet.service` | `bridge-tailnet --fingerprint `, shim on `:2620`, tunnel on `:2600` | | `bridge-tailscaled-.service`, `bridge-tailnet-.service` | The same pair for each further Bridge, on the next free ports (see below). | | `bridge-agent.service` | `bridge-agent`, environment from `/var/lib/bridge/agent.env` | | `bridge-agent-update.service` + `.timer` | `bridge-agent --self-update`, daily (see [Components and updates](/docs/components-and-updates/)) | `/var/lib/bridge/agent.env` (mode 0600) carries the server list, the SOCKS5 address, the enroll secret, `AGENT_HEADLESS=1`, `AGENT_RAG_ENABLED=0`, and the paths `bridgectl` reads back. `/var/lib/bridge/servers.json` (mode 0600) records every Bridge the machine is on, with its units, ports and state directory; `agent.env`'s server list is rebuilt from it whenever it changes. ## The order of operations The order is the security property, so it is worth knowing exactly: 1. Download and unpack the tarball; check every expected file is present. 2. Install the binaries, each copied in beside the old one and renamed over it, so nothing running has to stop. From here the script hands over to `bridgectl join` ([bridgectl](/docs/bridgectl/#join)), which does the rest. Start this Bridge's `bridge-tailscaled` and `bridge-tailnet`. 3. **Wait for the shim's `/key` to answer.** It answers only after `bridge-tailnet` has fetched the control plane's public key through a relay and checked it hashes to the fingerprint in the invite. A rogue relay fails here. 4. Only then hand the invite's preauth key to `tailscale up`, through a 0600 file rather than the command line, because `/proc//cmdline` is world-readable. 5. Find the server on the tailnet (`http://bridge:5173`, then `:2687`) and pin the address so restarts skip discovery. 6. Sign in through the tunnel with `POST /api/session`. The server identifies this machine by its tailnet tag, exactly as it does a browser, so the machine is owned by whoever the invite was minted for. 7. `POST /api/machines/register` returns the server URL and enroll secret. Neither is in the invite. An **agent-only** invite gets no session. Step 6 is refused by design, because nobody may sign in from that machine. The script then calls `POST /api/machines/register-agent` instead. That call is authenticated by the same tailnet tag and returns the same answer. The machine is owned by whoever created the invite. 8. Write `agent.env`, start `bridge-agent`, enable the update timer, and print every Bridge on the machine with a green or red dot for whether the agent is connected to it. If the release being installed has no `bridgectl join` yet (0.1.55 and earlier), the script runs the same steps itself, for one Bridge only. The machine joins sharing **no folders**. Choose one from Bridge (the **Add a machine** dialog shows them as soon as the machine connects), or run `sudo bridgectl folders add PATH`. ## Re-running Re-running the command is safe. It replaces the binaries without stopping anything, and then: - **With an invite from a Bridge the machine is already on**, it refreshes that Bridge's services and restarts them. It does not join again (an invite cannot be redeemed twice), and it keeps semantic search if it was installed. - **With an invite from a different Bridge**, it adds that Bridge alongside the others (next section). Nothing that was already there is stopped. - **If the join fails** (a bad or expired invite, a control plane that does not verify, no server found), it removes what it created for that invite and stops. The Bridges the machine was already on keep running. A machine broken by an older installer, one that fell off its Bridge after a re-run with another Bridge's invite, is repaired by running the current one with either invite: the first Bridge's services are put back from `agent.env`, which still named it. ## More than one Bridge A Linux machine can be on several Bridges at once, for example your team's and a friends-and-family one. Each Bridge gets its own tailnet stack, exactly as the Mac and Windows apps do it: | | first Bridge | each further Bridge | | --- | --- | --- | | units | `bridge-tailscaled`, `bridge-tailnet` | `bridge-tailscaled-`, `bridge-tailnet-` | | state | `/var/lib/bridge/tailnet` | `/var/lib/bridge/servers//tailnet` | | tunnel, shim, SOCKS5 | 2600, 2620, 2640 | next free in each block: 2601, 2621, 2641, ... | | screen share | 6712 | 6712 plus the tunnel's offset: 6713, ... | `` is the first eight characters of that Bridge's fingerprint. One agent serves them all. - **Folders are per Bridge.** A newly added Bridge sees no folders. Folders the machine already shared stay with the Bridges they were shared with, including any shared with "every server", which are narrowed to the Bridges present before the new one joined. Share with one Bridge using `sudo bridgectl folders add PATH --server NAME`. - **Device identity is per Bridge.** Each further Bridge gets its own agent id, so two teams never share a machine record. - **Peer-to-peer file fetches** (another device downloading a file this machine offers) work on every Bridge. The first one listens on port 2697; each further Bridge finds that port taken and uses a free loopback port instead, which it reports with each offer. This needs Bridge 0.1.69 or later; an older one served file fetches only on the first Bridge. `sudo bridgectl servers` lists them. `sudo bridgectl leave NAME` removes one and keeps the rest. ## Coexisting with a system Tailscale Userspace networking means no TUN device and no change to routes or DNS, and `--port=0` avoids the system daemon's WireGuard port. A Tailscale you already run is left alone. See [Networking](/docs/networking/). ## Removing it ```bash sudo bridgectl uninstall ``` This removes every Bridge the machine is on. To leave just one, use `sudo bridgectl leave NAME`. Then remove the machine from Bridge's device list. If `bridgectl` itself is gone: ```bash systemctl disable --now 'bridge-agent*' 'bridge-tailnet*' 'bridge-tailscaled*' rm -f /etc/systemd/system/bridge-*.service /etc/systemd/system/bridge-agent-update.timer rm -rf /usr/local/lib/bridge /usr/local/bin/bridge-agent /usr/local/bin/bridgectl /var/lib/bridge ``` --- # bridgectl Source: https://bridgedesktop.com/docs/bridgectl/ > The command for inspecting and managing a Linux install, command by command, with the flags, root requirements and what each one touches. `bridgectl` manages the Bridge agent on a Linux machine installed with [install.sh](/docs/linux-install/). It is the agent binary run under a second name: `/usr/local/bin/bridgectl` is a symlink to `/usr/local/lib/bridge/bridge-agent`, and the agent acts as the CLI when it sees that name. `bridge-agent ` does the same thing. It is not called `bridge` because iproute2 already ships `/usr/sbin/bridge`. Because it is the same binary, it is always the same version as the agent it manages, and it updates when the agent does. Source: `crates/agent/src/cli.rs`, `join.rs`, `component.rs` and `host.rs`. ## Summary ```text bridgectl status [--json] bridgectl join INVITE [--relay-override URL] [--no-auto-update] bridgectl servers [--wait] bridgectl leave NAME [--yes] bridgectl folders [list] bridgectl folders add PATH [--server NAME | --all] bridgectl folders remove PATH bridgectl logs [-f] [-n N] bridgectl update bridgectl channel [stable|canary] bridgectl uninstall [--yes] [--keep-state] [--purge-server] bridgectl version bridgectl semantic [status] bridgectl semantic enable [--force] bridgectl semantic disable bridgectl component [list] bridgectl component install NAME [--force] bridgectl component remove NAME bridgectl server setup --owner NAME bridgectl server invite NAME [--plain] bridgectl server status bridgectl metrics [summary|routes|slow|stalls|samples|profiles] [--hours N] [--limit N] [--json] [--db PATH] bridgectl help ``` Everything except `logs`, `version`, `help`, `metrics`, `semantic status` and a bare `channel` needs root, and says "run it with sudo" rather than failing on a permission error. The exit code is 0 on success and 1 on any error, with the reason on stderr prefixed `bridgectl:`. ## Where it finds the install It reads `/var/lib/bridge/agent.env` (or `$BRIDGE_STATE_DIR/agent.env`) for the agent's socket, the library and bin directories, and the tailnet socket, so an install made with custom paths is managed where it actually lives. `BRIDGE_LIB_DIR` and `BRIDGE_PREFIX` in the environment override the file. Installs from before these keys existed fall back to the installer's defaults. Which Bridges the machine is joined to is recorded in `/var/lib/bridge/servers.json` (mode 0600), written by `join` and `leave`. A machine installed before that file existed has none; it is read back from `agent.env` and the unit files the first time it is needed. Everything else comes from three places: systemd, each tailnet daemon's CLI, and the agent's local API on its Unix socket (mode 0600, owned by root, which is why most commands need root). ## status ```text sudo bridgectl status [--json] ``` One line each for the services (`bridge-agent`, and both tailnet units of every Bridge the machine is on), each tailnet (state, name, address), every server connection (state, machine id, and the reason when it was refused, such as a bad enroll secret or a blocked device), shared folders, and the update timer with its last result. It ends with the same list `servers` prints. Each part is asked separately, so a stopped agent still reports the services and tailnet. `--json` prints the combined object for scripts; `tailnets` has one entry per Bridge, and `tailnet` is the first of them, as before. ```text bridge-agent 0.1.60 services bridge-tailscaled active · bridge-tailnet active · bridge-tailscaled-fedcba98 active · bridge-tailnet-fedcba98 active · bridge-agent active tailnet Red One: Running as build-box (100.100.0.12) tailnet Friends: Running as build-box (100.64.0.7) server Red One: enrolled machine 3f2a19c0… server Friends: enrolled machine 81d0c2aa… folders 2 shared: /srv/app, /home/dan/code updates stable channel, daily timer on, last run Mon 2026-10-05 03:00:01 UTC ok Bridges on this machine: ● Red One connected 7c47ff94, port 2600 ● Friends connected fedcba98, port 2601 ``` ## join ```text sudo bridgectl join INVITE [--relay-override URL] [--no-auto-update] sudo bridgectl join --invite-file PATH ``` Joins this machine to the Bridge the invite came from. `install.sh` runs it for you after it has put the binaries in place; run it yourself to add a Bridge to a machine that already has the agent. The invite can also come from `BRIDGE_INVITE` in the environment, which keeps it off the command line. - **First Bridge.** Sets up `bridge-tailscaled` and `bridge-tailnet` on ports 2600 (tunnel), 2620 (control shim) and 2640 (SOCKS5), the same layout every earlier install has. - **Another Bridge.** Gets its own pair of units, `bridge-tailscaled-` and `bridge-tailnet-` (the first eight characters of its fingerprint), its own state in `/var/lib/bridge/servers//`, and the next free ports in each block (2601, 2621, 2641, and so on). The Bridges already on the machine keep running throughout. It also gets its own agent id, so it sees this machine as a separate device from any other team's. - **A Bridge it is already on.** Rewrites that Bridge's units for the current binaries and restarts them. It does not join again (an invite works once), and the other Bridges are not touched. The order is the installer's: start that Bridge's tailnet units, wait until `bridge-tailnet` has verified the control plane against the invite's fingerprint, only then hand the preauth key to `tailscale up` through a 0600 file, find the server, and register. If any step fails, everything it created for that Bridge is removed again, the node is logged out if it got that far, and the machine is as it was. When a Bridge is added, every folder that was shared with "every server" is first narrowed to the Bridges that were already there, so the new one starts with no folders. The agent is then restarted with the new server list. It finishes with the same list as `servers`. `--relay-override` is for a machine that hosts the Bridge it is joining (`install.sh --server` passes it). ## servers ```text sudo bridgectl servers [--wait] ``` One line per Bridge: a green dot when the agent is connected and enrolled, a red one with the state and the last error otherwise, then the fingerprint and tunnel port. With `--wait` it waits up to 30 seconds for a freshly restarted agent to connect before printing. Colour only on a terminal, and not when `NO_COLOR` is set. ## leave ```text sudo bridgectl leave NAME [--yes] ``` Removes one Bridge and keeps the rest. `NAME` is the name shown by `servers`, its fingerprint, or the fingerprint's first four characters or more. It logs that Bridge's node out, removes its two units and its state, takes it out of the agent's server list and restarts the agent. Refused for the only Bridge on the machine: use `uninstall` for that. Afterwards, remove the machine from that Bridge's device list. ## folders ```text sudo bridgectl folders [list] sudo bridgectl folders add PATH [--server NAME | --all] sudo bridgectl folders remove PATH ``` Lists, shares or stops sharing a folder, through the agent's own API, so the agent's validation applies: the path must be absolute and a real directory, and credential folders (`~/.ssh`, `~/.aws`, `~/.gnupg`, `~/.kube`) are refused. `add` canonicalises the path, so `bridgectl folders add .` works. Sharing only makes a folder available; add it to a project from Bridge (**Add a machine or folder**, then **Use a folder**). `remove` accepts a path that no longer exists on disk, since that is often exactly the one to stop sharing. On a machine joined to one Bridge, `add` shares with that Bridge. On a machine joined to several, say which: `--server NAME` (a name or fingerprint from `bridgectl servers`), or `--all` for every Bridge on the machine, including ones joined later. ## logs ```text bridgectl logs [-f] [-n N] ``` Runs `journalctl` for `bridge-agent`, every Bridge's `bridge-tailnet` and `bridge-tailscaled` units, and `bridge-agent-update`, interleaved. With no arguments it shows the last 100 lines; any arguments are passed to `journalctl` as they are. Reading the journal may itself need root, depending on the distribution. ## report ```text sudo bridgectl report [--since T] [--until T] [--note TEXT] [--dry-run] ``` Sends this machine's Bridge logs and status to Bridge support, for a problem you can describe but nobody can see from outside — most often "Bridge said *agent offline* for a minute while the machine and its network were fine". It bundles: - the journal of `bridge-agent`, every Bridge's `bridge-tailnet` and `bridge-tailscaled`, and `bridge-agent-update`, over the window; - restart counts and start times of those units (`systemctl show`); - `bridgectl status --json`; - the OS name, uptime, free disk space, and which Bridge ports are listening. Keys, tokens, enroll secrets and the home directory are redacted before anything leaves the machine. The window defaults to the last 24 hours; `--since` and `--until` take `journalctl` times (`-2h`, `"2026-11-18 07:20"`, `@1795419064`). It prints a report id such as `R-7KQ2M9` to quote when you tell support what happened and when. `--dry-run` writes the bundle to a file in `/tmp` and sends nothing, for a machine that cannot reach the report service or a person who wants to read it first. `BRIDGE_REPORT_URL` points it at a different service. The same machine's logs can also be collected from the web: **Report connection problem** on a failed tool call, or in a machine's **Connection history** (Settings → Fleet), asks the agent for them directly once it is connected. ## update ```text sudo bridgectl update ``` The same as the daily timer: fetch the release manifest, and if it names a newer version, verify and install it, then restart the agent, rolling back if it does not come back. Installed components come along. Exit code 0 means up to date or updated. See [Components and updates](/docs/components-and-updates/). ## channel ```text bridgectl channel sudo bridgectl channel stable|canary ``` With no argument, prints which release line this machine's updates follow (`stable` unless changed). With one, records it in `/var/lib/bridge/update-channel` and restarts `bridge-agent` if it is running, so Fleet shows the new value. It does not update by itself: - **Switching to canary** takes effect at the next daily check, or straight away with `sudo bridgectl update`. - **Switching back to stable** never downgrades. The machine keeps its canary build until stable is newer. The same choice can be made from **Fleet** in Bridge. See [Update channel](/docs/components-and-updates/#update-channel). ## uninstall ```text sudo bridgectl uninstall [--yes] [--keep-state] [--purge-server] ``` Lists what it will remove and asks for confirmation unless `--yes`. Then: 1. `tailscale logout` on every Bridge's tailnet, so each control plane drops the node instead of keeping a ghost. 2. `systemctl disable --now` every Bridge unit, including each additional Bridge's pair and the four hosting units if the machine hosts a Bridge. 3. Removes the unit files, `/usr/local/lib/bridge`, both links, and `/var/lib/bridge`. | flag | effect | | --- | --- | | `--yes`, `-y` | Do not ask. | | `--keep-state` | Keep `/var/lib/bridge` entirely (tailnet identity, folder list, search index). | | `--purge-server` | On a machine that hosts a Bridge, also delete `/var/lib/bridge/server` and `/var/lib/bridge/host`: the team's data and the control plane. Without it, those two are kept. | Shared folders themselves are never touched. Afterwards, remove the machine from Bridge's device list. ## version ```text bridgectl version ``` Prints `bridge-agent `. Also `--version` or `-V`. ## semantic ```text bridgectl semantic [status] sudo bridgectl semantic enable [--force] sudo bridgectl semantic disable ``` | command | effect | | --- | --- | | `status` | `on`, `disabled`, `not_installed` or `low_power`, and the device when it is low-power. | | `enable` | Installs the `semantic` component (the agent built with the embedding engine), verified against the release signature, and switches it on. Refused on a low-power machine. | | `enable --force` | The same, on a low-power machine too. | | `disable` | Sets `AGENT_RAG_ENABLED=0` and restarts the agent. Keyword search keeps working. | See [Semantic search](/docs/semantic-search/) for what counts as low-power. ## component ```text sudo bridgectl component [list] sudo bridgectl component install NAME [--force] sudo bridgectl component remove NAME ``` The optional pieces of a Linux install: | name | what it installs | | --- | --- | | `semantic` | `bridge-agent` built with the embedding engine, swapped in for the slim one. `--force` overrides the low-power refusal. | | `server` | `bridge-server`, its web client, `headscale` and `tailnet-sidecar`, into `/usr/local/lib/bridge/server`. | A component always matches the running agent's version. It is downloaded from that version's release manifest and verified by size, SHA-256 and Ed25519 signature before anything is written; a mismatch writes nothing. What is installed is recorded in `/var/lib/bridge/components.json`, and self-update keeps it current. See [Components and updates](/docs/components-and-updates/). ## server ```text sudo bridgectl server setup --owner NAME sudo bridgectl server invite NAME [--plain] sudo bridgectl server status ``` Host a Bridge on this machine. `install.sh --server` runs these for you; see [Self-hosting](/docs/self-hosting/) for what they set up. | command | effect | | --- | --- | | `setup --owner NAME` | Needs the `server` component. Writes the control plane's configuration, then starts and enables `bridge-headscale`, `bridge-sidecar`, `bridge-server-tailscaled` and `bridge-server`. Checks the control plane's fingerprint and joins this machine to its own tailnet as `bridge`. Safe to re-run: every step checks whether it already happened. `--owner` defaults to `$SUDO_USER`. | | `invite NAME` | Mints a single-use, 24-hour invite key for `NAME` and prints it in a box, green on a terminal and plain when piped or when `NO_COLOR` is set. `--plain` prints only the key. | | `status` | JSON: the four services, the server's `/api/health`, and the control plane's fingerprint. | Names are lowercase letters, digits and dashes, because each becomes a Headscale user and a `tag:user-` ACL tag. For testing beside an existing Bridge, `setup`, `invite` and `status` also take `--root DIR` (state somewhere else), `--port-offset N` (every port shifted by N) and `--no-systemd` (plain child processes instead of units; stop them with `server stop --no-systemd`). ## metrics ```text bridgectl metrics [summary|routes|slow|stalls|samples|profiles] [--hours N] [--limit N] [--json] [--db PATH] ``` The hosted server's recorded performance, read directly from its database on this machine. The server's own `/api/metrics/*` cannot be used here: it needs a tailnet identity and rejects loopback connections by design. This reads the same tables read-only and never contacts the running server. It needs read access to the database, which on a root-owned install means `sudo`. | view | what it shows | | --- | --- | | `summary` | the default: `stalls`, `routes`, `slow` and `profiles` together | | `routes` | slowest HTTP routes: count, p50, p95, max, total time, SQLite time, statements and bytes per request, 5xx count. Five-minute buckets kept 7 days; p95 is the worst bucket's | | `slow` | individual SQLite statements of 50 ms or more, with when, how long and who ran them (`chat:`, `http GET /route`, `job:`). Kept 14 days. `--worst` sorts by duration | | `stalls` | minutes where the event loop stalled 250 ms or more, or SQLite used 10 s, with the top owner and the CPU profile kept for it | | `samples` | the per-minute rollups: lag, CPU, RSS, SQLite time, running turns | | `profiles` | CPU profiles on disk, newest first | `--hours` sets the window (default 24), `--limit` the rows per view (default 25), and `--json` prints one JSON object instead of tables. The database defaults to `/var/lib/bridge/server/data/bridge.sqlite`; `--db` reads another. It runs an embedded script with the installed `bridge-server` binary acting as a plain Bun runtime (`BUN_BE_BUN=1`), so nothing else needs installing. On a machine without the server component it uses `bun` from `PATH`. From a source checkout the same reader is `bun packages/server/scripts/metrics-dump.mjs`. CPU profiles are written to `profiles/` beside the database (`/var/lib/bridge/server/data/profiles/` on an install) as `bridge-