# Technical Documentation: lollipopkit/flutter_server_box

> ℹ️ **Provenance:** Multi-Tier Ingestion · [CodeWiki Reference](https://codewiki.google/github.com/lollipopkit/flutter_server_box)

### Overview (`README.md`)

English | [简体中文](README_zh.md)

<h2 align="center">Flutter Server Box</h2>

<div align="center">
  <a href="https://discord.gg/SsVNbRhK7w"><img alt="discord" src="https://img.shields.io/badge/Discord-lpkt-purple"></a>
  <a href="https://qm.qq.com/q/daCGa7eShG"><img alt="qq" src="https://img.shields.io/badge/QQ-Group-pink"></a>
  <a href="https://t.me/lpktg"><img alt="telegram" src="https://img.shields.io/badge/Telegram-lpktg-green"></a>
  <a href="https://lollipopkit.com/donate"><img alt="donate" src="https://img.shields.io/badge/donate-me-pink"></a>
</div>

<p align="center">
A Flutter+Rust project which provides charts to display Linux, Unix and Windows server status and tools to manage servers.
<br>
Read the <a href="https://serverbox.lollipopkit.com/docs/">documentation site</a> for user guides, architecture notes, and development instructions.
</p>

## Acknowledgements

Special thanks to <a href="https://github.com/TerminalStudio/dartssh2">dartssh2</a> & <a href="https://github.com/TerminalStudio/xterm.dart">xterm.dart</a>.
Thanks to my partner for their emotional and financial support.
Thanks to <a href="https://openai.com">OpenAI</a> for providing six months of ChatGPT Pro 20x subscription.

## Screenshots

<table>
  <tr>
    <td><img width="420" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/mac/home.jpg?v=20261125" alt="Desktop server list"></td>
    <td><img width="420" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/mac/server-details.jpg?v=20261125" alt="Desktop server details"></td>
  </tr>
  <tr>
    <td><img width="420" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/mac/terminal.jpg?v=20261125" alt="Desktop terminal"></td>
    <td><img width="420" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/mac/files.jpg?v=20261125" alt="Desktop files"></td>
  </tr>
</table>

<table>
  <tr>
    <td><img width="180" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/iphone/home.jpg" alt="iPhone server list"></td>
    <td><img width="180" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/iphone/server-details.jpg" alt="iPhone server details"></td>
    <td><img width="180" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/iphone/terminal.jpg" alt="iPhone terminal"></td>
    <td><img width="180" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/iphone/files.jpg" alt="iPhone files"></td>
  </tr>
</table>

<details>
<summary>More screenshots (Desktop, iPhone Duo, iPhone)</summary>
<br>

**Desktop**
<table>
  <tr>
    <td><img width="420" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/mac/container.jpg?v=20261125" alt="Desktop containers"></td>
    <td><img width="420" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/mac/process.jpg?v=20261125" alt="Desktop processes"></td>
  </tr>
  <tr>
    <td><img width="420" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/mac/users.jpg?v=20261125" alt="Desktop users"></td>
    <td><img width="420" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/mac/agent.jpg?v=20261125" alt="Desktop Agent"></td>
  </tr>
  <tr>
    <td><img width="420" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/mac/settings.jpg?v=20261125" alt="Desktop themes and settings"></td>
    <td><img width="420" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/mac/more.jpg?v=20261125" alt="Desktop tools"></td>
  </tr>
</table>

**iPhone Duo**
<table>
  <tr>
    <td><img width="280" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/iphone-duo/home.jpg" alt="iPhone Duo server list"></td>
    <td><img width="280" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/iphone-duo/server-details.jpg" alt="iPhone Duo server details"></td>
    <td><img width="280" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/iphone-duo/terminal.jpg" alt="iPhone Duo terminal"></td>
  </tr>
  <tr>
    <td><img width="280" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/iphone-duo/files.jpg" alt="iPhone Duo files"></td>
    <td><img width="280" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/iphone-duo/agent.jpg" alt="iPhone Duo Agent"></td>
    <td><img width="280" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/iphone-duo/settings.jpg" alt="iPhone Duo themes and settings"></td>
  </tr>
</table>

**iPhone**
<table>
  <tr>
    <td><img width="180" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/iphone/container.jpg" alt="iPhone containers"></td>
    <td><img width="180" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/iphone/process.jpg" alt="iPhone processes"></td>
    <td><img width="180" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/iphone/services.jpg" alt="iPhone services"></td>
    <td><img width="180" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/iphone/users.jpg" alt="iPhone users"></td>
  </tr>
  <tr>
    <td><img width="180" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/iphone/agent.jpg" alt="iPhone Agent"></td>
    <td><img width="180" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/iphone/bench.jpg" alt="iPhone benchmark"></td>
    <td><img width="180" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/iphone/virt.jpg" alt="iPhone virtualization"></td>
    <td><img width="180" loading="lazy" src="https://cdn.lollipopkit.com/serverbox/screenshot/iphone/themes.jpg" alt="iPhone theme store"></td>
  </tr>
</table>
</details>


## Installation

| Platform | Download |
| --- | --- |
| iOS | [AppStore](https://apps.apple.com/app/id1586449703) / [GitHub](https://github.com/lollipopkit/flutter_server_box/releases) (`_NoSign.ipa`, unsigned, you need to sign it yourself) |
| macOS | [GitHub](https://github.com/lollipopkit/flutter_server_box/releases) (architecture-specific `.dmg`) / `brew install --cask server-box` |
| Android | [GitHub](https://github.com/lollipopkit/flutter_server_box/releases) / [F-Droid](https://f-droid.org/packages/tech.lolli.toolbox) / [OpenAPK](https://www.openapk.net/serverbox/tech.lolli.toolbox/) |
| Windows | [GitHub](https://github.com/lollipopkit/flutter_server_box/releases) (`.exe` installer & portable `.zip`) / `winget install lollipopkit.serverbox` / `scoop bucket add extras && scoop install extras/serverbox` |
| Linux | [GitHub](https://github.com/lollipopkit/flutter_server_box/releases) (`.deb`, `.rpm`, `.AppImage`, portable `.tar.gz`) |

Download packages only from sources you trust.

## Features

**Connecting**

- Connect directly over SSH, through a jump host or with a `ProxyCommand`, with [SSH host key and CA certificate verification](https://serverbox.lollipopkit.com/docs/advanced/host-keys/), private key management, LAN SSH discovery, Wake-on-LAN and [bulk JSON import](https://serverbox.lollipopkit.com/docs/advanced/bulk-import/).
- Connect over HTTP through the [Monitor](https://serverbox.lollipopkit.com/docs/advanced/monitor-agent/) when you do not want to expose a host's SSH port. A server can use both SSH and Monitor, with automatic fallback if one is unavailable.
- Open a shell on this device or install a Linux userland ([local terminal](https://serverbox.lollipopkit.com/docs/advanced/local-terminal/)) on supported platforms.

**Watching**

- Live and historical charts for CPU, memory, swap, disks, disk I/O and network, plus sensors, GPUs (NVIDIA, AMD), batteries, disk S.M.A.R.T. and [custom commands](https://serverbox.lollipopkit.com/docs/advanced/custom-commands/).
- See all servers at a glance, filter them by tag or view them on a [globe](https://serverbox.lollipopkit.com/docs/advanced/globe/).
- Push alerts (with custom threshold rules and notification channels), [home-screen widgets](https://serverbox.lollipopkit.com/docs/advanced/widgets/), a watchOS app and a macOS menu bar tray. The Monitor keeps alerts, widgets and the watch app working while the app is closed.

**Working on a server**

- A full terminal with virtual keys on phones, tmux integration, [program status](https://serverbox.lollipopkit.com/docs/advanced/program-status/) indicators and notifications, plus a [workspace](https://serverbox.lollipopkit.com/docs/advanced/workspace/) with split panes that can send input to several terminals at once.
- Browse, upload, download and edit files over SFTP, SCP or the Monitor file API. Markdown files open in a rendered preview.
- [RDP and VNC](https://serverbox.lollipopkit.com/docs/advanced/remote-desktop/), to the server itself or to a desktop it can reach.
- Docker and Podman, processes, systemd services, users and groups, firewall rules (`ufw`, `firewalld`), storage management (disks, RAID, ZFS), network shares (SMB, NFS), scheduled tasks, power actions, port forwards and snippets.
- Virtual machines and containers on libvirt and Proxmox VE (snapshots, hardware, backups, VNC and serial consoles), and a server's hardware over Redfish ([BMC](https://serverbox.lollipopkit.com/docs/advanced/bmc/)).
- Benchmarks (YABS) and `iperf`.
- **Monitor web panel:** a desktop-style web UI served by the Monitor with built-in server tools, Docker Compose [Monitor Apps](https://serverbox.lollipopkit.com/docs/advanced/monitor-apps/), sandboxed third-party [Desk Apps](https://serverbox.lollipopkit.com/docs/advanced/monitor-desk-apps/) (`.fsba`), encrypted [Monitor settings backup](https://serverbox.lollipopkit.com/docs/advanced/monitor-backup/) and [Monitor Agent Mode](https://serverbox.lollipopkit.com/docs/advanced/monitor-agent-mode/).

**AI & Automation**

- A built-in [AI Agent](https://serverbox.lollipopkit.com/docs/advanced/agent/) that works with your servers and the model providers, MCP servers and skills you choose.
- A built-in [App MCP server](https://serverbox.lollipopkit.com/docs/advanced/app-mcp/) (HTTP and stdio bridge) with scoped tokens so external MCP clients can reach every server ServerBox manages.
- [`serverbox://` links](https://serverbox.lollipopkit.com/docs/advanced/url-scheme/) to open a server, tool or snippet from Shortcuts, launchers and scripts.

**Making it yours**

- Install [themes and icon packs](https://serverbox.lollipopkit.com/docs/advanced/theme-packages/) from the built-in store, or make your own.
- Biometric app lock, and encrypted backups and sync via iCloud or WebDAV with a password you choose.
- iOS, watchOS, Android, macOS, Linux and Windows, in 17 languages.

## Help

- [ServerBox Monitor](https://github.com/lollipopkit/flutter_server_box/tree/main/monitor) is a component you install on your servers. It is required for features that need to work while the app is closed — **push notifications**, **home-screen widgets**, and the **watch app**. It also offers another way to add a server: the app can connect to it over HTTP instead of SSH, which suits hosts whose SSH port you prefer not to expose, and gives charts historical data from before the app's first connection. Monitor also serves its own web panel.
- **Agent skills:** This repository includes three skills for AI agents. Add them with

  ```sh
  npx skills add lollipopkit/flutter_server_box
  ```

  - [`serverbox-help`](.claude/skills/serverbox-help): using the app and deploying and configuring the Monitor — adding servers, why a feature is missing for a server, permissions, alerts, widgets, backups. The app's own Agent ships with it.
  - [`serverbox-onboarding`](.claude/skills/serverbox-onboarding): working on the code — setting up the Flutter + Rust + Node environment, building and testing, and how the project works.
  - [`serverbox-theme`](.claude/skills/serverbox-theme): making a theme package (`.fsbt`), validating it and publishing it to the theme store.

  Their source is in this repository, so you can read what they will tell your Monitor before installing them.

Before opening an issue, please:

1. Use the bug report template.
2. Confirm that the issue is caused by ServerBox.
3. Concrete, constructive feedback is welcome. Subjective requests, such as preferring another UI, may not be accepted.

## Contributions

[CONTRIBUTING.md](CONTRIBUTING.md) covers the development setup, the commit convention, the checks to run, and how translations work.

Contributors sign the [CLA](CLA.md) once by leaving a comment on their first pull request. It grants the right to ship your work in App Store builds alongside the AGPLv3 source. You retain the copyright to your work.

If I forgot to add your name to the contributors list, please add a comment in the issue or PR you opened to let me know, I will add it as soon as possible.

## My other apps

- [LLMBox](https://github.com/lollipopkit/llmbox): a third-party client for the OpenAI API.
- [MFuse](https://mfuse.lollipopkit.com): mounts SFTP, S3, WebDAV and more in macOS Finder through File Provider.
- [MosaicIt](https://mosaic.lollipopkit.com): redacts names, phone numbers, IDs, QR codes, faces and more in screenshots, completely offline.

## License

`AGPL v3 lollipopkit & all contributors`

---

### Overview (`docs/README.md`)

# ServerBox Documentation

The documentation site uses [Astro Starlight](https://starlight.astro.build)
and is published at <https://serverbox.lollipopkit.com/docs/>. It is served under
`/docs` of the project website; `scripts/build-cloudflare-pages.sh` builds both
sites and copies this site's output into `website/dist/docs/`.

## Structure

```
docs/
├── dev/                    # Developer notes, not part of the site (virt.md)
├── public/                 # Static assets (favicons, ...)
├── src/content/docs/       # Pages — English at the top level
│   ├── advanced/
│   ├── development/
│   ├── zh/                 # Simplified Chinese, mirroring the layout above
│   └── *.mdx               # introduction, installation, quick-start, index
└── astro.config.mjs        # Locales and sidebar, including sidebar translations
```

Each `.md` / `.mdx` file under `src/content/docs/` becomes a route named after
its path. A page added in English needs a matching file under `zh/`, and a new
sidebar entry in `astro.config.mjs` carries its own `translations` map.

**Locales are English and Simplified Chinese only.** German, Spanish, French and
Japanese were dropped in Aug 2026 — they had drifted out of sync with the code
and there was no one maintaining them.

## Commands

Run from `docs/`:

| Command | Action |
| :------ | :----- |
| `npm ci` | Install the locked dependencies |
| `npm run dev` | Dev server at `localhost:4321/docs` |
| `npm run check-locale-parity` | Check that English and Simplified Chinese pages mirror each other |
| `npm run build` | Build to `./dist/` |
| `npm run preview` | Preview the build locally |

## Writing

Documentation follows the code. When a page describes changed behaviour,
update it in the same change and keep the English and Simplified Chinese pages
in sync.

---

### Overview (`monitor/README.md`)

English | [简体中文](README_zh.md)

# ServerBox Monitor

ServerBox Monitor is the server-side component for
[ServerBox](https://github.com/lollipopkit/flutter_server_box). It records
server metrics, serves the Monitor HTTP API, and can host the web panel.
The configuration format may change between releases, so review
`config.example.toml` after upgrading.


## 🖥️ Screenshots
<table>
  <tr>
    <td>
	    <h5 align="center">iOS push</h5>
    </td>
    <td>
	    <h5 align="center">Webhook push (QQ)</h5>
    </td>
    <td>
	    <h5 align="center">iOS widget</h5>
    </td>
  </tr>
  <tr>
    <td>
	    <img width="107px" src="doc/imgs/ios-push.png">
    </td>
    <td>
	    <img width="307px" src="doc/imgs/webhook.png">
    </td>
    <td>
	    <img width="197px" src="doc/imgs/ios-widget.png">
    </td>
  </tr>
</table>

## Install and run

```sh
# systemd: a `systemctl --user` service, running as your own account
curl -fsSL https://raw.githubusercontent.com/lollipopkit/flutter_server_box/main/monitor/install.sh | sh -s -- install

# OpenRC (Alpine): needs root to write /etc/init.d, but still runs the Monitor
# as the account you sudo'd from
curl -fsSL https://raw.githubusercontent.com/lollipopkit/flutter_server_box/main/monitor/install.sh | sudo sh -s -- install

# Either init system, as root
curl -fsSL https://raw.githubusercontent.com/lollipopkit/flutter_server_box/main/monitor/install.sh | sudo sh -s -- install --system

# Without a published release to fetch — offline, or an unreleased build
curl -fsSL https://raw.githubusercontent.com/lollipopkit/flutter_server_box/main/monitor/install.sh | SBM_INSTALL_PKG=/path/to/server-box-monitor sh -s -- install
```

Everything after `sh -s --` is passed to the script, so `uninstall` and
`upgrade` go the same way. It is also in this repository, so `./install.sh
install` from this directory does the same job — with this checkout's copy of
the script, which is not necessarily the one on `main` that the commands above
fetch.

`install.sh install` downloads the newest `monitor-v*` release of this
repository. Releases are cut by the `monitor-release.yml` workflow, which is
`workflow_dispatch`-only; when no such release exists, use `SBM_INSTALL_PKG`
with a locally built package, or [Docker](Dockerfile).

A machine with no operating system to install it on can boot **sbOS**
instead: each release carries images with the Monitor, its panel and Docker on
Alpine Linux (`sbOS_musl_*`) or Debian (`sbOS_GNU_*`), for x64 and arm64.
Write one to a USB stick and boot it, or run `sbm-install` on it to put the
system on a disk — see [`os/README.md`](os/README.md).

`upgrade` without `--user` or `--system` finds the installed form itself and
reruns through `sudo` for a system unit or OpenRC; with none installed it
changes nothing. It replaces the files while the Monitor runs and restarts it
last, so it can run in a terminal the Monitor opened (which then closes). The
Monitor reads its releases itself (`GET /api/v1/update`, every 12 hours, with a
desk notification per newer version); the panel's Settings → Server and the
App's Monitor tab offer the same command
(`sbm_parser::monitor_agent::upgrade_command`) in a terminal.

Configuration lives in `config.toml` beside the binary. Every key, with the
comments explaining it, is in [`config.example.toml`](config.example.toml);
`cargo run -- config` prints the resolved values. The Monitor listens on
`0.0.0.0:3770` and serves its own panel there when `frontend/dist` is present.

### Signing in

The Monitor has one account, signed in with its password alone. It lives in the
SQLite database, not in `config.toml` — `jwt_secret` there signs tokens and is
not a password. On the first start the Monitor sets a random password and writes
it beside the database as `initial-admin-credentials.txt` (0600). Change it and
delete that file:

```sh
cd /opt/server-box-monitor   # or ~/.local/share/server-box-monitor
./server_box_monitor password
```

It prompts twice without echo, and `--password-env VAR` reads the password from
the environment instead; there is no argument form, since a command line reaches
`ps` and the shell history. The app and the panel can change it too. Run it from
the Monitor's own directory — `config.toml` and the database path are relative to
the working directory, so elsewhere it silently sets a password in a new, empty
database.

### What the ServerBox app needs

A server added to the app as a **monitor** server is reached through this
Monitor's HTTP API and nowhere else — it carries no SSH credentials. The Monitor
reports what it serves on `GET /api/v1/capabilities`, and the app offers
exactly that:

| App feature | Endpoint |
|---|---|
| Status, charts, stored history | `/api/v1/metrics*` (a watch token may read these too) |
| Processes, systemd, containers, snippets, power, the app's terminal | `POST /api/v1/exec`, `/api/v1/terminal/ws` |
| File browser | `/api/v1/fs/*` |
| Remote desktop, local and dynamic port forwards | `/api/v1/stream/ws` |
| Remote port forwards | `/api/v1/listen/ws` |
| The panel's remote desktops (VNC, RDP) | `/api/v1/stream/ws`, `/api/v1/rdp/ws` |

`/api/v1/stream/ws` relays one TCP connection to an address the app names,
dialled from this machine as the Monitor's account. `/api/v1/listen/ws` is the
other direction: the Monitor listens on a port here and hands each connection to
the app, which takes it over a `stream` socket.

SFTP is not offered on a monitor server: the Monitor's file API moves file
contents rather than an SSH byte stream.

## Access

**Whoever signs in may do what the system account the Monitor runs as may do**:
a shell, its files, connections from this machine, listening on its ports. There
are no roles or per-feature permissions: the account the Monitor is installed as
is the limit. That is why `install.sh` runs the Monitor as an ordinary account by
default — a `systemctl --user` service under systemd, or an `/etc/init.d` script
with `command_user` under OpenRC — and `--system` (root) makes signing in a root
shell. The full API contract is
[Monitor API and Access Model](https://serverbox.lollipopkit.com/docs/development/monitor-agent/).

A terminal (the app's or the panel's) is that same shell on a PTY. Sessions
survive a dropped connection for a few minutes, so a phone changing networks
rejoins the same shell instead of losing it.

Changing the password signs out every other session: tokens issued before it
stop working, paired watches and widgets are unpaired, and open terminals,
relays and listeners are closed.

Upgrading from a Monitor with several accounts keeps the oldest admin's password
and moves the other accounts' Agent mode tasks, memory and desk themes to it.

Notes:

- Everything beyond reading the numbers needs TLS or a loopback caller — a
  reverse proxy on the same host counts, since loopback traffic can't be read
  off the network. On a trusted private network with transport encryption
  outside HTTP (for example Tailscale), an operator may set
  `[remote_access] allow_insecure = true` (the older `terminal.allow_insecure`
  and `fs.allow_insecure` count as it). The App must separately enable **Allow
  insecure HTTP** for that individual Monitor connection; both opt-ins are
  required. Credentials, terminal traffic and file contents are otherwise sent
  in plaintext, so do not use this for an ordinary LAN or a network you do not
  control.
- The file API never serves the Monitor's own state: its database, `jwt.secret`,
  `config.toml`, `.env`, TLS key and the like.
- `access_log` records what was opened, from where, and whether it worked. It
  never records a credential.
- Failed logins are throttled per source address and, for a client that has
  not signed in before, on a counter all such clients share. A sign-in hands
  the device a token; a device that sends it is throttled on its own, so
  failures elsewhere cannot lock it out. Changing the password forgets every
  device.

## License
`GPL v3. lollipopkit 2023`

---

### Overview (`assets/distro/README.md`)

# Distribution marks

Four logos, shipped with the app and drawn beside a server's name when nothing
else says where a mark comes from — **in one colour**, taking the colour of the
text beside them. A column of full-colour logos at the size of a line of text
reads as noise rather than as information, and that single decision is half the
reason this list is four and not five. Every other distribution is fetched from an
address the user configures — `serverMarkUrl`, expanding `{DIST}` — and this
directory has nothing to do with it.

## Why four

Three questions have to be answered before a logo can be *shipped* here, and
only the first is easy.

**Trademark** is the easy one. Showing a distribution's mark next to a server
in order to say *this server runs that distribution* is nominative use — a mark
used to refer to the thing it identifies. It is a doctrine rather than a
permission any owner grants, and the usual test is three parts: the thing is
not readily identifiable without the mark, no more of the mark is used than
needed, and nothing suggests sponsorship or endorsement. A 20px mark in a row
that also carries the server's own name and address meets all three.

**Copyright in the artwork** is the hard one, and it is what this directory is
short because of. A logo is somebody's drawing. Redistributing it needs a
licence, and almost no project grants one — a trademark policy permitting
referential use says nothing about copying the file. Five projects do, and
four of those five are here — the fifth is below:

| Mark | Licence | Source |
| --- | --- | --- |
| debian | [LGPL-3+ or CC BY-SA 3.0](https://www.debian.org/logos/) | `openlogo-nd.svg` |
| gentoo | [CC BY-SA 2.5](https://www.gentoo.org/inside-gentoo/artwork/gentoo-logo.html) | `gentoo-signet.svg` |
| nixos | [CC BY 4.0](https://github.com/NixOS/nixos-artwork) | `logo/nix-snowflake-colours.svg` |
| alpine | [no copyright subsists](https://commons.wikimedia.org/wiki/File:Alpine_Linux.svg) | `alpinelinux-logo-icon.svg` |

(Rocky Linux was the fifth, under CC BY-SA 4.0. See below for why it is not.)

Alpine is the odd one: its mark is simple geometry, which under 37 CFR 202.1
attracts no copyright at all ("familiar symbols or designs"), so there is
nothing to license. Wikimedia Commons files it as `PD-textlogo`. The trademark
is still the Alpine Linux Development Team's.

**Whether the owner permits altering it** is the third question, and it only
came up once the marks were drawn in a single colour. Recolouring is a
modification; every one of the licences above permits modification, but a
trademark policy can still object to it. Of the five, one does — see Rocky
below. Gentoo's guidelines restrict aspect ratio and shape and say nothing
about colour; Debian, NixOS and Alpine publish nothing on the point.

The four Creative Commons licences all require attribution. That is discharged
in the app itself — Settings → About → License, registered by
`lib/data/model/server/dist_license.dart` — because this file ships inside the
bundle but nothing renders it, and a notice nobody can reach is not one.

## What was checked and rejected

Not for want of asking. Each of these permits the *word* or referential use and
reserves the artwork:

- **Ubuntu** — the Circle of Friends is a Canonical trademark, supplied as
  artwork under brand guidelines rather than under any free licence.
  Canonical's [IP policy](https://canonical.com/legal/intellectual-property-policy)
  permits referring to Ubuntu; it does not permit redistributing the logo.
- **Fedora** — [the logo page](https://fedoraproject.org/wiki/Logo) says the
  logo "is a registered trademark used worldwide by Red Hat, Inc." with
  restrictions set out in the trademark guidelines, and permission requests go
  to logo@fedoraproject.org. It is also drawn in a proprietary font that Red
  Hat pays for, which is a second reason the file is not ours to pass on.
- **Arch** — "The Arch Linux name and logo are recognized trademarks. Some
  rights reserved." Retired logos remain under licence restrictions; the
  CC-BY-SA on [the policy](https://terms.archlinux.org/docs/trademark-policy/)
  covers the policy document, not the mark.
- **openSUSE** — the trap worth recording. `openSUSE/artwork` is CC BY-SA 3.0
  at its root, but `logos/official/LICENSE` says, of the logos specifically:
  "These logos are all rights reserved." A repository-level licence is not a
  file-level one, and this is the only place so far where the two disagree.
- **Rocky Linux** — the one dropped for the third question rather than the
  second. Its artwork *is* free, CC BY-SA 4.0, and it was shipped here. But the
  [trademark policy](https://rockylinux.org/legal/trademarks) says "You may not
  alter or modify any of the Foundation Marks in any way", and drawing it in
  one colour is altering it. Keeping it would have meant one colour logo in a
  monochrome column, which reads as a bug; putting the column back to colour
  for its sake would have meant every other mark reading as noise. So it goes,
  and Rocky falls back to the penguin like Ubuntu does.
- **Red Hat**, **Raspberry Pi**, **Kali** — all three reserve logo use to
  written permission outright, and their marks are illustrations rather than
  shapes, so redrawing would not have answered the copyright either.

## Adding one

Find a statement from the project that licenses the *artwork*, not the
trademark, and permits redistribution — and then check that nothing in the
project's own terms forbids drawing it in a single colour, which is how it will
be drawn. A CC licence, a GPL/LGPL, or a
below-the-threshold mark like Alpine's. If all you can find is a trademark
policy, however permissive, the answer is no — leave it to the address the
user configures.

Then: drop the file in named after its `Dist` case, add the case to `_bundled`
in `dist.dart`, add a row to the table above, and add its notice to
`dist_license.dart`. `test/unit/server/dist_icon_test.dart` fails if any of those is
missing.

**Ship the file unmodified**, as far as it will go. Not tidied, not
recoloured, not stripped of its metadata — under CC BY-SA a modified file is an
adaptation and carries the share-alike obligation, and the metadata is where
some of these carry their own attribution. flutter_svg logs
`unhandled element <metadata/>` once per run for the trouble, which is the
right trade.

**Then check it draws**, because "unmodified" is not the same as "works".
`debian.svg` is a 2001 Adobe Illustrator export and did not: the parser strips
namespaces before reading attribute names, so `xmlns:x="http://ns.adobe.com/…"`
arrives as an attribute called `x` and its value goes to `double.parse`. It
threw on load and flutter_svg drew an empty box — no exception reaching the
app, nothing in the log, just a gap where the swirl should be. What fixed it is
recorded with the file below.

`test/unit/server/dist_asset_render_test.dart` compiles each of these the way flutter_svg
does and fails if one yields no geometry or no paint. It is the only test here
that would have caught that, and four others passed straight through it: the
file existed, the enum named it, the README listed it and the widget built.

## Changes made to the files

- **debian.svg** — the DTD's entity declarations expanded in place and dropped,
  and Illustrator's `xmlns:x`/`xmlns:i`/`xmlns:graph`/`xmlns:a` declarations and
  the `i:`-namespaced attributes under them removed. Nothing else: the twelve
  `d=` path strings are byte-identical to what Debian publishes, and the two
  render the same. Debian offers the logo under LGPL-3+ *or* CC BY-SA 3.0, and
  either permits this so long as the change is stated — which is what this line
  is for, and why it is repeated in the in-app notice.
- The other four are byte-identical to their sources.

---

### Overview (`crates/sbm_ffi/README.md`)

Please ignore this folder, which is just glue to build Rust with Flutter.

---

### Overview (`monitor/os/README.md`)

# sbOS

ServerBox Monitor and Docker as a bootable system. Two flavours, one
behaviour:

| Image | Based on | Init | Boots |
|---|---|---|---|
| `sbOS_musl_x64.img`, `sbOS_musl_arm64.img` | Alpine Linux 3.24 | OpenRC | x64 BIOS and UEFI, arm64 UEFI |
| `sbOS_GNU_x64.img`, `sbOS_GNU_arm64.img` | Debian 13 | systemd | x64 BIOS and UEFI, arm64 UEFI |

Write one to a USB stick (`dd`, Etcher, Ventoy) or boot it in a virtual
machine. sbOS is not affiliated with Alpine Linux or Debian; Debian is a
registered trademark owned by Software in the Public Interest, Inc. See
[`common/NOTICE`](common/NOTICE) (also in the image, in
`/usr/share/server-box-monitor/`).

## Using it

On boot the console shows:

```
sbOS: ServerBox Monitor at https://192.168.1.20:3770
Certificate SHA-256: 3A:9F:...
First password (as root): cat /home/sbm/.local/share/server-box-monitor/initial-admin-credentials.txt
```

- The agent listens over HTTPS with a self-signed certificate made on the
  machine's first boot. The browser warns about it; compare the fingerprint
  with the one on the console before accepting it. Another certificate:
  `SBM_TLS_CERT`/`SBM_TLS_KEY` in the agent's `.env`.
- The console is a root shell without a password (sshd refuses an empty one).
  Set a root password if others can reach the console.
- The agent runs as the account `sbm` (in the `docker` group), installed by
  `install.sh` in its default form: an OpenRC service with `command_user` on
  musl, a systemd user service (lingering) on GNU. `install.sh upgrade` and
  `uninstall` work as documented in `monitor/README.md`.

### Live or installed

Booted from the medium the system runs from RAM: the database, Docker's images
and the apps' data are gone after a reboot. To keep them, install it on a disk:

```sh
sbm-install /dev/sda      # erases the disk; asks you to type its name
```

The agent installs itself again on the disk's first boot, with a new database
and a new certificate.

- musl: Alpine's `setup-disk -m sys`. The system's packages come from the
  medium, the kernel and firmware from Alpine's mirror (the network is
  needed); `/etc` is carried over.
- GNU: the image's root filesystem is copied as it was built (no network
  needed), with GRUB for UEFI and, on x64, BIOS.

## Building it

Docker is the only requirement (macOS or Linux):

```sh
./build.sh musl                         # the host's arch, the version in monitor/Cargo.toml
./build.sh gnu --arch arm64 --version 0.2.0
./build.sh gnu --pkg path/to/server-box-monitor_v0.2.0_linux_amd64.tar.gz
```

Without `--pkg`, the release tarball of that version is downloaded and checked
against its `SHA256SUMS`. The output in `out/`: the image, its `.sha256`, and
`.packages.txt`, which lists every distribution package inside and where its
source is (Alpine's aports commit and distfiles; snapshot.debian.org at the
build's date). Another architecture than the host's needs qemu's binfmt
(`docker run --privileged --rm tonistiigi/binfmt --install arm64`).
`monitor-release.yml` builds all four and attaches them to the release.

| Path | Role |
|---|---|
| `build.sh` | Fetches the package, adds this checkout's `install.sh`, runs the flavour's build in a container |
| `common/sbm-setup` | On boot (both): the account, the certificate, `install.sh install` when missing, the console text |
| `common/NOTICE` | Trademarks, licences, where the sources are |
| `musl/mkimage.sh` | In `alpine:3.22`: aports' `mkimage.sh` (pinned commit) with the `sbm` profile |
| `musl/profile/` | The package list (`SBM_WORLD`: the system; `apks`: the medium) and the overlay |
| `musl/overlay/` | OpenRC's `sbm-setup`, `sbm-install`, what `setup-disk` carries (`protected_paths.d`) |
| `gnu/mkimage.sh` | In `debian:trixie` (privileged): live-build, its package list and hook |
| `gnu/includes/` | systemd units (`sbm-setup`, network, host keys, Docker's live data), `sbm-install` |

Moving to a new release: musl `ALPINE_BRANCH` and `APORTS_COMMIT` in
`musl/mkimage.sh` (`alpine:3.22` stays until aports' `mkimage.sh` stops
passing `apk add --no-chown`, which apk-tools 3 refuses as root); GNU `SUITE`
in `gnu/mkimage.sh` and the container in `build.sh`.

---

### Overview (`third_party/proto/README.md`)

# Vendored protobuf schemas

## `tombstone.proto`

Android's schema for the crash record `ApplicationExitInfo.getTraceInputStream()`
returns for `REASON_CRASH_NATIVE` on API 31 and later. It is the only way this
app can see where a native crash happened — in the Rust FFI, the Linux engine,
proot or sqlite — since a crash there takes the process with it and no Dart code
runs afterwards.

- Upstream: `system/core/debuggerd/proto/tombstone.proto`
- Source: <https://android.googlesource.com/platform/system/core/+/refs/heads/main/debuggerd/proto/tombstone.proto>
- Licence: Apache-2.0, as part of AOSP `system/core`
- Vendored verbatim. Do not edit it: a local change would be lost the next time
  it is refreshed, and it would no longer describe what a device writes.

### Why it is here rather than in `android/`

Decoding happens in Dart. Doing it on the Kotlin side would put
`protobuf-javalite` and the protobuf Gradle plugin into the module F-Droid
rebuilds from source and `androidReproducible` compares byte for byte, and it
would be reachable only from a device that has already crashed. In Dart it is
one pure-Dart package and the decoder is covered by `flutter test`.

### Regenerating

```sh
make gen-proto
```

Which needs `protoc` (`brew install protobuf`) and installs `protoc_plugin` from
pub. Output goes to `lib/src/proto/` and is committed, so an ordinary build and
CI need neither tool. That directory is generated: do not edit it, and it is
excluded from the analyzer in `analysis_options.yaml` because protoc emits
relative imports between its own files.

### Refreshing the schema

Fetch the upstream file again and regenerate:

```sh
curl -sSL -o third_party/proto/tombstone.proto \
  https://raw.githubusercontent.com/aosp-mirror/platform_system_core/main/debuggerd/proto/tombstone.proto
make gen-proto
```

Only worth doing when a new Android release adds a field this app would read.
Fields it does not know about are skipped by the protobuf runtime, so a stale
copy loses information rather than breaking — which is also why the tests here
cannot detect one. `lib/core/service/tombstone.dart` reads `signal_info`,
`abort_message`, `causes`, `pid`, `tid` and each thread's `current_backtrace`.

---

### Overview (`monitor/examples/desk-app-hello/README.md`)

# Example desk app

A `web` desk app (`docs/src/content/docs/development/desk-app-reference.md`): a counter kept in the app's
storage, a toolbar button and a menu that send a notification.

Package it and install it as an admin (Settings → Apps, or the API):

```sh
COPYFILE_DISABLE=1 tar -czf example.hello.fsba manifest.json ui  # macOS: no ._ files
```

---

### Overview (`monitor/examples/desk-app-uptime/README.md`)

# Example desk app with a backend

A `wasm` desk app (`docs/src/content/docs/development/desk-app-reference.md`): the UI asks its backend
(`src/lib.rs`, a component the agent runs; its service is
`wit/uptime.wit`) for the machine's uptime (the `status` permission), and
for `who` (`process`).

```sh
cargo build --release --target wasm32-wasip2
cp target/wasm32-wasip2/release/desk_app_uptime.wasm backend.wasm
COPYFILE_DISABLE=1 tar -czf example.uptime.fsba manifest.json backend.wasm ui
```

---

### Overview (`monitor/sdk/serverbox-desk/README.md`)

# serverbox-desk

The client an installed desk app uses, from inside its sandboxed frame, to
reach the ServerBox monitor's desk. The design, the permissions and the
message protocol: [Developing Desk Apps](https://serverbox.lollipopkit.com/docs/development/desk-apps/)
and the [Desk App Reference](https://serverbox.lollipopkit.com/docs/development/desk-app-reference/).
A starting point: [`monitor/sdk/template`](https://github.com/lollipopkit/flutter_server_box/tree/main/monitor/sdk/template).

```sh
npm install serverbox-desk
```

```ts
import { connect } from 'serverbox-desk'

const desk = await connect()
await desk.toolbar({ actions: [{ id: 'refresh', label: 'Refresh', icon: 'refresh' }] })
desk.on('action', ({ id }) => { /* … */ })
// Pages of its own, in the window's sidebar like the desk's apps
await desk.sidebar({ sections: [{ items: [{ id: 'status', label: 'Status', icon: 'info' }, { id: 'logs', label: 'Logs', icon: 'article' }] }], selected: 'status' })
desk.on('navigate', ({ id }) => { /* … */ })
const count = (await desk.storage.get<number>('count')) ?? 0
await desk.storage.set('count', count + 1)

// A `wasm` app's backend: a function of its WIT `api`, and one of its `jobs`
// run as root after the desk's own sudo dialog.
const notes = await desk.call('list', { folder: 'work' })
await desk.job('reindex', {}, { sudo: { title: 'Reindex', body: 'Reads every folder as root.' }, onLine: console.log })
```

Once `connect()` resolves, the page is in the desk's design system: the desk
serves its stylesheet (`/desk-app/desk.css`) and keeps the page in its mode
and theme, so the app writes markup with its classes and tokens and carries
none of it ([Desk App Reference, "UI"](https://serverbox.lollipopkit.com/docs/development/desk-app-reference/#ui)):

```html
<body>
  <div class="lk-card">
    <button class="lk-btn lk-btn--primary"><span class="lk-icon" data-icon="play_arrow"></span>Run</button>
  </div>
</body>
```

`connect({ style: false })` leaves the page alone.

`src/protocol.ts` is the protocol itself; the desk's side
(`monitor/frontend/src/desk/webapps/bridge.svelte.ts`) imports it from here,
and `monitor/frontend/src/tests/deskSdk.test.ts` runs this client against it.

`npm run build` writes `dist/`, what the package exports (`npm publish` runs
it first); the panel and its tests use `src/` directly.

Apache-2.0 (`LICENSE`, `NOTICE`): an app built on it, closed-source included,
keeps its own license.

---

### Overview (`monitor/sdk/template/README.md`)

# Desk app template

A `web` desk app built with `serverbox-desk` (`../serverbox-desk`,
Apache-2.0) and vite.
Read the [Desk App Reference](https://serverbox.lollipopkit.com/docs/development/desk-app-reference/) first.

```sh
npm install
npm run pack        # dist/ + manifest.json -> <id>.fsba
```

Here `serverbox-desk` is the copy beside it (`file:../serverbox-desk`), which needs
`npm run build --prefix ../serverbox-desk` once; a copy of this template elsewhere
depends on the published `serverbox-desk` instead.

Install the package as an admin in Settings → Apps, then approve it.

- Change `publisher` and `name` in `manifest.json`: the app's id is
  `<publisher>.<name>` (`acme.notes`), made from them.
- The UI runs in a sandboxed frame with no network: everything it needs is
  in the bundle, and it reaches the desk only through `connect()`.
- URLs in the bundle must be relative (`base: './'`).
- `connect()` puts the desk's design system on the page and keeps it in the
  desk's mode and theme: write markup with its `lk-*` classes and tokens
  ([Desk App Reference, "UI"](https://serverbox.lollipopkit.com/docs/development/desk-app-reference/#ui))
  rather than your own colours. Its
  implementation is the desk's and is never in the package, so the app looks
  right only inside ServerBox. `connect({ style: false })` opts out.
- For a backend, set `"kind": "wasm"`, add `backend.wasm` next to
  `manifest.json` in the package, and call it with `desk.backend(method, params)`
  (see `monitor/examples/desk-app-uptime`).

---

### Src Content Docs Index (`docs/src/content/docs/index.mdx`)

---
title: Server Box
description: A cross-platform server management application
hero:
  tagline: Monitor and manage Linux servers remotely
  actions:
    - text: Get Started
      link: /docs/introduction/
      icon: right-arrow
      variant: primary
    - text: View on GitHub
      link: https://github.com/lollipopkit/flutter_server_box
      icon: github
      variant: minimal
---

import { Card, CardGrid } from '@astrojs/starlight/components';

## Main features

<CardGrid stagger>
	<Card title="Real-time monitoring" icon="chart">
		View live data and charts for CPU, memory, disks, network, GPU, and temperature.
	</Card>
	<Card title="SSH terminal" icon="terminal">
		Connect over SSH with multiple terminal tabs and a virtual keyboard on mobile.
	</Card>
	<Card title="SFTP file browser" icon="folder">
		Browse and manage files on servers and this device.
	</Card>
	<Card title="Container management" icon="box">
		Start, stop, and monitor Docker or Podman containers from the App.
	</Card>
	<Card title="Cross-platform" icon="device-mobile">
		Available on iOS, Android, macOS, Linux, Windows, and watchOS.
	</Card>
	<Card title="Multiple languages" icon="globe">
		Use the App in your preferred language.
	</Card>
</CardGrid>

## Quick links

- **Download**: Get Server Box from the [App Store](https://apps.apple.com/app/id1586449703), [GitHub Releases](https://github.com/lollipopkit/flutter_server_box/releases), [F-Droid](https://f-droid.org/packages/tech.lolli.toolbox), or [OpenAPK](https://www.openapk.net/serverbox/tech.lolli.toolbox/)
- **Documentation**: Read the [Introduction](/docs/introduction/) to get started
- **Support**: Join the conversation on [GitHub Discussions](https://github.com/lollipopkit/flutter_server_box/discussions), or open an [Issue](https://github.com/lollipopkit/flutter_server_box/issues)

---

### Src Content Docs Zh Index (`docs/src/content/docs/zh/index.mdx`)

---
title: Server Box
description: 一款跨平台的服务器管理应用
hero:
  tagline: 远程监控和管理 Linux 服务器
  actions:
    - text: 开始使用
      link: /docs/zh/introduction/
      icon: right-arrow
      variant: primary
    - text: 在 GitHub 上查看
      link: https://github.com/lollipopkit/flutter_server_box
      icon: github
      variant: minimal
---

import { Card, CardGrid } from '@astrojs/starlight/components';

## 主要功能

<CardGrid stagger>
	<Card title="实时监控" icon="chart">
		查看 CPU、内存、磁盘、网络、GPU 和温度的实时数据与图表。
	</Card>
	<Card title="SSH 终端" icon="terminal">
		通过 SSH 连接服务器，支持多个终端标签页和移动端虚拟键盘。
	</Card>
	<Card title="SFTP 文件浏览器" icon="folder">
		浏览和管理服务器及本机文件。
	</Card>
	<Card title="容器管理" icon="box">
		直接在应用中启动、停止和监控 Docker 或 Podman 容器。
	</Card>
	<Card title="跨平台" icon="device-mobile">
		支持 iOS、Android、macOS、Linux、Windows 和 watchOS。
	</Card>
	<Card title="多语言" icon="globe">
		可使用偏好的语言操作 App。
	</Card>
</CardGrid>

## 快速链接

- **下载**：从 [App Store](https://apps.apple.com/app/id1586449703)、[GitHub Releases](https://github.com/lollipopkit/flutter_server_box/releases)、[F-Droid](https://f-droid.org/packages/tech.lolli.toolbox) 或 [OpenAPK](https://www.openapk.net/serverbox/tech.lolli.toolbox/) 下载
- **文档**：阅读[入门指南](/docs/zh/introduction/)开始使用 Server Box
- **支持**：在 [GitHub Discussions](https://github.com/lollipopkit/flutter_server_box/discussions) 参与讨论，或提交 [Issue](https://github.com/lollipopkit/flutter_server_box/issues)

---

### Package.Json (`docs/package.json`)

{
  "name": "docs",
  "type": "module",
  "version": "0.0.1",
  "scripts": {
    "dev": "astro dev",
    "start": "astro dev",
    "build": "sh ../scripts/check-lfs.sh docs && node scripts/check-locale-parity.mjs && astro build",
    "check-locale-parity": "node scripts/check-locale-parity.mjs",
    "preview": "astro preview",
    "astro": "astro"
  },
  "dependencies": {
    "@astrojs/starlight": "^0.43.1",
    "astro": "^7.4.13",
    "sharp": "^0.35.5"
  },
  "overrides": {
    "@expressive-code/core": {
      "postcss-nested": "8.0.1"
    }
  }
}

---

### Tsconfig.Json (`docs/tsconfig.json`)

{
  "extends": "astro/tsconfigs/strict",
  "include": [".astro/types.d.ts", "**/*"],
  "exclude": ["dist"]
}

---

### Schemas Fsbt Manifest.Schema.Json (`docs/schemas/fsbt-manifest.schema.json`)

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://raw.githubusercontent.com/lollipopkit/flutter_server_box/main/docs/schemas/fsbt-manifest.schema.json",
  "title": "ServerBox theme package manifest",
  "description": "manifest.toml at the root of a .fsbt archive. The installer refuses an unknown table, an unknown field, and a value out of range rather than replacing it with a default, so this schema is as strict as the installer: it is meant to name a mistake while you type instead of after an install. See https://serverbox.lollipopkit.com/docs/development/theme-authoring/\n\nOne rule cannot be written here: a color under icons.colors whose key has no entry under icons.images is refused, because a cross-table check is not something a JSON Schema expresses. Every table is optional; the required keys are the ones no default exists for.\n\nWith kind = \"icons\" the manifest is an icon pack (schema 4): icons only, chosen apart from the theme and drawn over whichever one is in use, so none of a theme's tables.",
  "type": "object",
  "additionalProperties": false,
  "required": ["id", "name", "schema"],
  "if": { "required": ["kind"] },
  "then": {
    "required": ["icons"],
    "propertyNames": { "enum": ["format", "schema", "id", "name", "kind", "icons"] },
    "properties": {
      "schema": { "properties": { "min": { "minimum": 4 } } },
      "icons": {
        "required": ["images"],
        "propertyNames": { "enum": ["images", "colors"] },
        "properties": { "images": { "minProperties": 1 } }
      }
    }
  },
  "else": { "required": ["modes"] },
  "properties": {
    "format": {
      "description": "Archive manifest structure version. Only 1 exists.",
      "const": 1
    },
    "kind": {
      "description": "\"icons\" for an icon pack (schema 4): icons only, chosen apart from the theme. Absent for a theme.",
      "const": "icons"
    },
    "id": {
      "description": "Stable identifier. A theme repository names the file for a theme after this.",
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9._-]{0,63}$"
    },
    "name": {
      "description": "Display name in Theme preset.",
      "type": "string",
      "minLength": 1,
      "maxLength": 80,
      "pattern": "^[^\\u0000-\\u001f]+$"
    },
    "modes": {
      "description": "Supported theme modes. One mode locks ThemeMode; both allow System, Light and Dark. Duplicates and unknown values are refused.",
      "type": "array",
      "minItems": 1,
      "maxItems": 2,
      "uniqueItems": true,
      "items": { "enum": ["light", "dark"] }
    },
    "schema": {
      "description": "Inclusive range of theme schema versions this package is readable at, not the theme's own version. min is what a reader has to understand: a package that uses a schema 2 feature and says min = 1 is refused, and so is one that uses a schema 3 component, field or [layout] and says a min below 3, or carries more than 48 icons and says a min below 4. See \"Schema versions\" in https://serverbox.lollipopkit.com/docs/development/theme-authoring/",
      "type": "object",
      "additionalProperties": false,
      "required": ["min", "max"],
      "properties": {
        "min": { "$ref": "#/definitions/schemaVersion" },
        "max": { "$ref": "#/definitions/schemaVersion" }
      }
    },
    "colors": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "mode": {
          "description": "Initial brightness preference: 0 system, 1 light, 2 dark. A single supported mode overrides it.",
          "type": "integer",
          "minimum": 0,
          "maximum": 2
        },
        "seed": {
          "description": "ARGB seed for roles the palettes do not set. Defaults to 0xFF880E4F.",
          "type": "integer",
          "minimum": 0,
          "maximum": 4294967295
        },
        "systemColor": {
          "description": "Use the system accent when the platform provides one. Defaults to false.",
          "type": "boolean"
        },
        "palette": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "light": { "$ref": "#/definitions/palette" },
            "dark": { "$ref": "#/definitions/palette" }
          }
        }
      }
    },
    "icons": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "style": {
          "description": "Built-in icon family, used for every key this package carries no image for.",
          "enum": ["classic", "mingcute"]
        },
        "images": {
          "description": "Icon key to the file that carries it, inside icons/. The file name must be the key with dots replaced by underscores, and either extension; nothing else can be named. A PNG is at most 512x512 and 256 KiB, an SVG at most 256 KiB and is checked as a document. Both are tinted with one color, so a drawing should use currentColor.",
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "tab.server": { "enum": ["icons/tab_server.png", "icons/tab_server.svg"] },
            "tab.server.selected": { "enum": ["icons/tab_server_selected.png", "icons/tab_server_selected.svg"] },
            "tab.ssh": { "enum": ["icons/tab_ssh.png", "icons/tab_ssh.svg"] },
            "tab.ssh.selected": { "enum": ["icons/tab_ssh_selected.png", "icons/tab_ssh_selected.svg"] },
            "tab.file": { "enum": ["icons/tab_file.png", "icons/tab_file.svg"] },
            "tab.file.selected": { "enum": ["icons/tab_file_selected.png", "icons/tab_file_selected.svg"] },
            "tab.snippet": { "enum": ["icons/tab_snippet.png", "icons/tab_snippet.svg"] },
            "tab.snippet.selected": { "enum": ["icons/tab_snippet_selected.png", "icons/tab_snippet_selected.svg"] },
            "tab.agent": { "enum": ["icons/tab_agent.png", "icons/tab_agent.svg"] },
            "tab.agent.selected": { "enum": ["icons/tab_agent_selected.png", "icons/tab_agent_selected.svg"] },
            "tab.benchmark": { "enum": ["icons/tab_benchmark.png", "icons/tab_benchmark.svg"] },
            "tab.benchmark.selected": { "enum": ["icons/tab_benchmark_selected.png", "icons/tab_benchmark_selected.svg"] },
            "tab.remoteDesktop": { "enum": ["icons/tab_remoteDesktop.png", "icons/tab_remoteDesktop.svg"] },
            "tab.remoteDesktop.selected": { "enum": ["icons/tab_remoteDesktop_selected.png", "icons/tab_remoteDesktop_selected.svg"] },
            "tab.virt": { "enum": ["icons/tab_virt.png", "icons/tab_virt.svg"] },
            "tab.virt.selected": { "enum": ["icons/tab_virt_selected.png", "icons/tab_virt_selected.svg"] },
            "tab.workspace": { "enum": ["icons/tab_workspace.png", "icons/tab_workspace.svg"] },
            "tab.workspace.selected": { "enum": ["icons/tab_workspace_selected.png", "icons/tab_workspace_selected.svg"] },
            "tab.monitor": { "enum": ["icons/tab_monitor.png", "icons/tab_monitor.svg"] },
            "tab.monitor.selected": { "enum": ["icons/tab_monitor_selected.png", "icons/tab_monitor_selected.svg"] },
            "nav.more": { "enum": ["icons/nav_more.png", "icons/nav_more.svg"] },
            "nav.settings": { "enum": ["icons/nav_settings.png", "icons/nav_settings.svg"] },
            "nav.tune": { "enum": ["icons/nav_tune.png", "icons/nav_tune.svg"] },
            "nav.privacy": { "enum": ["icons/nav_privacy.png", "icons/nav_privacy.svg"] },
            "nav.agent": { "enum": ["icons/nav_agent.png", "icons/nav_agent.svg"] },
            "nav.tabs": { "enum": ["icons/nav_tabs.png", "icons/nav_tabs.svg"] },
            "nav.server": { "enum": ["icons/nav_server.png", "icons/nav_server.svg"] },
            "nav.sort": { "enum": ["icons/nav_sort.png", "icons/nav_sort.svg"] },
            "nav.terminal": { "enum": ["icons/nav_terminal.png", "icons/nav_terminal.svg"] },
            "nav.folder": { "enum": ["icons/nav_folder.png", "icons/nav_folder.svg"] },
            "nav.cloud": { "enum": ["icons/nav_cloud.png", "icons/nav_cloud.svg"] },
            "nav.snippet": { "enum": ["icons/nav_snippet.png", "icons/nav_snippet.svg"] },
            "nav.inbox": { "enum": ["icons/nav_inbox.png", "icons/nav_inbox.svg"] },
            "nav.key": { "enum": ["icons/nav_key.png", "icons/nav_key.svg"] },
            "nav.info": { "enum": ["icons/nav_info.png", "icons/nav_info.svg"] },
            "nav.download": { "enum": ["icons/nav_download.png", "icons/nav_download.svg"] },
            "nav.desktop": { "enum": ["icons/nav_desktop.png", "icons/nav_desktop.svg"] },
            "file.bash": { "enum": ["icons/file_bash.png", "icons/file_bash.svg"] },
            "file.c": { "enum": ["icons/file_c.png", "icons/file_c.svg"] },
            "file.cc": { "enum": ["icons/file_cc.png", "icons/file_cc.svg"] },
            "file.cer": { "enum": ["icons/file_cer.png", "icons/file_cer.svg"] },
            "file.cfg": { "enum": ["icons/file_cfg.png", "icons/file_cfg.svg"] },
            "file.cjs": { "enum": ["icons/file_cjs.png", "icons/file_cjs.svg"] },
            "file.conf": { "enum": ["icons/file_conf.png", "icons/file_conf.svg"] },
            "file.cpp": { "enum": ["icons/file_cpp.png", "icons/file_cpp.svg"] },
            "file.crt": { "enum": ["icons/file_crt.png", "icons/file_crt.svg"] },
            "file.css": { "enum": ["icons/file_css.png", "icons/file_css.svg"] },
            "file.cts": { "enum": ["icons/file_cts.png", "icons/file_cts.svg"] },
            "file.cxx": { "enum": ["icons/file_cxx.png", "icons/file_cxx.svg"] },
            "file.dart": { "enum": ["icons/file_dart.png", "icons/file_dart.svg"] },
            "file.default": { "enum": ["icons/file_default.png", "icons/file_default.svg"] },
            "file.dir": { "enum": ["icons/file_dir.png", "icons/file_dir.svg"] },
            "file.dockerfile": { "enum": ["icons/file_dockerfile.png", "icons/file_dockerfile.svg"] },
            "file.erl": { "enum": ["icons/file_erl.png", "icons/file_erl.svg"] },
            "file.ex": { "enum": ["icons/file_ex.png", "icons/file_ex.svg"] },
            "file.exs": { "enum": ["icons/file_exs.png", "icons/file_exs.svg"] },
            "file.flac": { "enum": ["icons/file_flac.png", "icons/file_flac.svg"] },
            "file.gif": { "enum": ["icons/file_gif.png", "icons/file_gif.svg"] },
            "file.gitattributes": { "enum": ["icons/file_gitattributes.png", "icons/file_gitattributes.svg"] },
            "file.gitignore": { "enum": ["icons/file_gitignore.png", "icons/file_gitignore.svg"] },
            "file.gitmodules": { "enum": ["icons/file_gitmodules.png", "icons/file_gitmodules.svg"] },
            "file.go": { "enum": ["icons/file_go.png", "icons/file_go.svg"] },
            "file.gql": { "enum": ["icons/file_gql.png", "icons/file_gql.svg"] },
            "file.graphql": { "enum": ["icons/file_graphql.png", "icons/file_graphql.svg"] },
            "file.gz": { "enum": ["icons/file_gz.png", "icons/file_gz.svg"] },
            "file.h": { "enum": ["icons/file_h.png", "icons/file_h.svg"] },
            "file.hh": { "enum": ["icons/file_hh.png", "icons/file_hh.svg"] },
            "file.hpp": { "enum": ["icons/file_hpp.png", "icons/file_hpp.svg"] },
            "file.hrl": { "enum": ["icons/file_hrl.png", "icons/file_hrl.svg"] },
            "file.htm": { "enum": ["icons/file_htm.png", "icons/file_htm.svg"] },
            "file.html": { "enum": ["icons/file_html.png", "icons/file_html.svg"] },
            "file.ini": { "enum": ["icons/file_ini.png", "icons/file_ini.svg"] },
            "file.java": { "enum": ["icons/file_java.png", "icons/file_java.svg"] },
            "file.jpeg": { "enum": ["icons/file_jpeg.png", "icons/file_jpeg.svg"] },
            "file.jpg": { "enum": ["icons/file_jpg.png", "icons/file_jpg.svg"] },
            "file.js": { "enum": ["icons/file_js.png", "icons/file_js.svg"] },
            "file.json": { "enum": ["icons/file_json.png", "icons/file_json.svg"] },
            "file.jsx": { "enum": ["icons/file_jsx.png", "icons/file_jsx.svg"] },
            "file.key": { "enum": ["icons/file_key.png", "icons/file_key.svg"] },
            "file.kt": { "enum": ["icons/file_kt.png", "icons/file_kt.svg"] },
            "file.kts": { "enum": ["icons/file_kts.png", "icons/file_kts.svg"] },
            "file.less": { "enum": ["icons/file_less.png", "icons/file_less.svg"] },
            "file.link": { "enum": ["icons/file_link.png", "icons/file_link.svg"] },
            "file.lock": { "enum": ["icons/file_lock.png", "icons/file_lock.svg"] },
            "file.log": { "enum": ["icons/file_log.png", "icons/file_log.svg"] },
            "file.lua": { "enum": ["icons/file_lua.png", "icons/file_lua.svg"] },
            "file.makefile": { "enum": ["icons/file_makefile.png", "icons/file_makefile.svg"] },
            "file.markdown": { "enum": ["icons/file_markdown.png", "icons/file_markdown.svg"] },
            "file.md": { "enum": ["icons/file_md.png", "icons/file_md.svg"] },
            "file.mdx": { "enum": ["icons/file_mdx.png", "icons/file_mdx.svg"] },
            "file.mjs": { "enum": ["icons/file_mjs.png", "icons/file_mjs.svg"] },
            "file.mkv": { "enum": ["icons/file_mkv.png", "icons/file_mkv.svg"] },
            "file.mp3": { "enum": ["icons/file_mp3.png", "icons/file_mp3.svg"] },
            "file.mp4": { "enum": ["icons/file_mp4.png", "icons/file_mp4.svg"] },
            "file.mts": { "enum": ["icons/file_mts.png", "icons/file_mts.svg"] },
            "file.pdf": { "enum": ["icons/file_pdf.png", "icons/file_pdf.svg"] },
            "file.pem": { "enum": ["icons/file_pem.png", "icons/file_pem.svg"] },
            "file.php": { "enum": ["icons/file_php.png", "icons/file_php.svg"] },
            "file.pl": { "enum": ["icons/file_pl.png", "icons/file_pl.svg"] },
            "file.pm": { "enum": ["icons/file_pm.png", "icons/file_pm.svg"] },
            "file.png": { "enum": ["icons/file_png.png", "icons/file_png.svg"] },
            "file.py": { "enum": ["icons/file_py.png", "icons/file_py.svg"] },
            "file.pyi": { "enum": ["icons/file_pyi.png", "icons/file_pyi.svg"] },
            "file.pyw": { "enum": ["icons/file_pyw.png", "icons/file_pyw.svg"] },
            "file.rb": { "enum": ["icons/file_rb.png", "icons/file_rb.svg"] },
            "file.rs": { "enum": ["icons/file_rs.png", "icons/file_rs.svg"] },
            "file.sass": { "enum": ["icons/file_sass.png", "icons/file_sass.svg"] },
            "file.scss": { "enum": ["icons/file_scss.png", "icons/file_scss.svg"] },
            "file.sh": { "enum": ["icons/file_sh.png", "icons/file_sh.svg"] },
            "file.sql": { "enum": ["icons/file_sql.png", "icons/file_sql.svg"] },
            "file.svg": { "enum": ["icons/file_svg.png", "icons/file_svg.svg"] },
            "file.swift": { "enum": ["icons/file_swift.png", "icons/file_swift.svg"] },
            "file.tar": { "enum": ["icons/file_tar.png", "icons/file_tar.svg"] },
            "file.toml": { "enum": ["icons/file_toml.png", "icons/file_toml.svg"] },
            "file.ts": { "enum": ["icons/file_ts.png", "icons/file_ts.svg"] },
            "file.tsx": { "enum": ["icons/file_tsx.png", "icons/file_tsx.svg"] },
            "file.txt": { "enum": ["icons/file_txt.png", "icons/file_txt.svg"] },
            "file.vue": { "enum": ["icons/file_vue.png", "icons/file_vue.svg"] },
            "file.wav": { "enum": ["icons/file_wav.png", "icons/file_wav.svg"] },
            "file.webm": { "enum": ["icons/file_webm.png", "icons/file_webm.svg"] },
            "file.webp": { "enum": ["icons/file_webp.png", "icons/file_webp.svg"] },
            "file.xml": { "enum": ["icons/file_xml.png", "icons/file_xml.svg"] },
            "file.yaml": { "enum": ["icons/file_yaml.png", "icons/file_yaml.svg"] },
            "file.yml": { "enum": ["icons/file_yml.png", "icons/file_yml.svg"] },
            "file.zip": { "enum": ["icons/file_zip.png", "icons/file_zip.svg"] },
            "file.zsh": { "enum": ["icons/file_zsh.png", "icons/file_zsh.svg"] }
          }
        },
        "colors": {
          "description": "Per-icon color. A key must name an icon icons.images carries; a color for a key with no image is refused, since it would be a typo that shows up as nothing at all. Without an entry the icon follows the ambient icon color.",
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "tab.server": { "$ref": "#/definitions/color" },
            "tab.server.selected": { "$ref": "#/definitions/color" },
            "tab.ssh": { "$ref": "#/definitions/color" },
            "tab.ssh.selected": { "$ref": "#/definitions/color" },
            "tab.file": { "$ref": "#/definitions/color" },
            "tab.file.selected": { "$ref": "#/definitions/color" },
            "tab.snippet": { "$ref": "#/definitions/color" },
            "tab.snippet.selected": { "$ref": "#/definitions/color" },
            "tab.agent": { "$ref": "#/definitions/color" },
            "tab.agent.selected": { "$ref": "#/definitions/color" },
            "tab.benchmark": { "$ref": "#/definitions/color" },
            "tab.benchmark.selected": { "$ref": "#/definitions/color" },
            "tab.remoteDesktop": { "$ref": "#/definitions/color" },
            "tab.remoteDesktop.selected": { "$ref": "#/definitions/color" },
            "tab.virt": { "$ref": "#/definitions/color" },
            "tab.virt.selected": { "$ref": "#/definitions/color" },
            "tab.workspace": { "$ref": "#/definitions/color" },
            "tab.workspace.selected": { "$ref": "#/definitions/color" },
            "tab.monitor": { "$ref": "#/definitions/color" },
            "tab.monitor.selected": { "$ref": "#/definitions/color" },
            "nav.more": { "$ref": "#/definitions/color" },
            "nav.settings": { "$ref": "#/definitions/color" },
            "nav.tune": { "$ref": "#/definitions/color" },
            "nav.privacy": { "$ref": "#/definitions/color" },
            "nav.agent": { "$ref": "#/definitions/color" },
            "nav.tabs": { "$ref": "#/definitions/color" },
            "nav.server": { "$ref": "#/definitions/color" },
            "nav.sort": { "$ref": "#/definitions/color" },
            "nav.terminal": { "$ref": "#/definitions/color" },
            "nav.folder": { "$ref": "#/definitions/color" },
            "nav.cloud": { "$ref": "#/definitions/color" },
            "nav.snippet": { "$ref": "#/definitions/color" },
            "nav.inbox": { "$ref": "#/definitions/color" },
            "nav.key": { "$ref": "#/definitions/color" },
            "nav.info": { "$ref": "#/definitions/color" },
            "nav.download": { "$ref": "#/definitions/color" },
            "nav.desktop": { "$ref": "#/definitions/color" }
          },
          "patternProperties": {
            "^file\\.[a-z][a-z0-9]*$": { "$ref": "#/definitions/color" }
          }
        }
      }
    },
    "background": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "description": "\"gradient\" is generated from the palette; \"image\" needs the file beside the manifest.",
          "enum": ["none", "gradient", "image"]
        },
        "image": {
          "description": "Only valid when type is \"image\".",
          "enum": ["background.png", "background.jpg", "background.jpeg"]
        },
        "opacity": {
          "description": "Image opacity. Does not affect the generated gradient. Defaults to 0.18.",
          "type": "number",
          "minimum": 0,
          "maximum": 0.6
        },
        "blur": {
          "description": "Image blur radius. Does not affect the generated gradient. Defaults to 0.",
          "type": "number",
          "minimum": 0,
          "maximum": 30
        },
        "tile": {
          "description": "Schema 3. Repeat the image as a pattern, each repeat this many logical pixels wide, from the top left. Omitted draws the image once, cover-fitted. Only valid when type is \"image\".",
          "type": "number",
          "minimum": 16,
          "maximum": 1024
        }
      }
    },
    "shapes": {
      "description": "Corner radii in logical pixels. A component override takes precedence over these. Omitted values default to 12, 8 and 10.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "card": { "$ref": "#/definitions/ratio" },
        "tile": { "$ref": "#/definitions/ratio" },
        "button": { "$ref": "#/definitions/ratio" }
      }
    },
    "splash": {
      "description": "Drawn over the app's first frames, then faded out. It is read once, at launch: choosing another theme later does not play a splash again, and a package selected during a launch does not play its own. Omit the table for no splash.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "color": {
          "description": "Background color. Defaults to \"surface\".",
          "$ref": "#/definitions/color"
        },
        "logo": {
          "description": "One fixed name at the archive root, not a path. A PNG or JPEG is at most 2048x2048 and 512 KiB, an SVG 512 KiB and the same document checks as an icon. Drawn at 96 logical pixels, centered, and tinted like an icon only when it is an SVG: a raster logo keeps its own colors.",
          "enum": ["splash_logo.png", "splash_logo.jpg", "splash_logo.jpeg", "splash_logo.svg"]
        },
        "duration": {
          "description": "Milliseconds the splash stays up before fading out. Defaults to 600.",
          "type": "integer",
          "minimum": 100,
          "maximum": 3000
        }
      }
    },
    "components": {
      "description": "Component overrides. Every table and field is optional; a missing field keeps the app's style, and an explicit zero or false is retained. Unknown component names, fields, states and role names are refused. Colors accept an ARGB integer or a ColorScheme role name, resolved against the final palette.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "card": { "$ref": "#/definitions/card" },
        "tile": { "$ref": "#/definitions/tile" },
        "button": { "$ref": "#/definitions/button" },
        "textButton": { "$ref": "#/definitions/textButton" },
        "outlinedButton": { "$ref": "#/definitions/outlinedButton" },
        "iconButton": { "$ref": "#/definitions/iconButton" },
        "input": { "$ref": "#/definitions/input" },
        "search": { "$ref": "#/definitions/search" },
        "navigation": { "$ref": "#/definitions/navigation" },
        "appBar": { "$ref": "#/definitions/appBar" },
        "segmented": { "$ref": "#/definitions/segmented" },
        "sidebar": { "$ref": "#/definitions/sidebar" },
        "dialog": { "$ref": "#/definitions/dialog" },
        "sheet": { "$ref": "#/definitions/sheet" },
        "menu": { "$ref": "#/definitions/menu" },
        "tooltip": { "$ref": "#/definitions/tooltip" },
        "toast": { "$ref": "#/definitions/toast" },
        "switch": { "$ref": "#/definitions/switch" },
        "slider": { "$ref": "#/definitions/slider" },
        "progress": { "$ref": "#/definitions/progress" },
        "badge": { "$ref": "#/definitions/badge" },
        "chip": { "$ref": "#/definitions/chip" },
        "divider": { "$ref": "#/definitions/divider" },
        "scrollbar": { "$ref": "#/definitions/scrollbar" },
        "light": { "$ref": "#/definitions/brightnessGroup" },
        "dark": { "$ref": "#/definitions/brightnessGroup" }
      }
    },
    "layout": {
      "description": "Schema 3. App-wide layout.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "density": {
          "description": "Spacing of Material controls. Omitted keeps the platform's default.",
          "enum": ["compact", "standard", "comfortable"]
        }
      }
    },
    "variants": {
      "description": "Schema 3. Several themes in one package, e.g. the Trans, Nonbinary and Rainbow variants of Pride. Each variant is the package's own tables with its table drawn over them (tables merge, anything else replaces), and is offered in the picker as a theme of its own. Files in variants/<key>/ replace the package's file of the same name for that variant.",
      "type": "object",
      "minProperties": 1,
      "maxProperties": 8,
      "propertyNames": { "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$" },
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "required": ["name"],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80,
            "pattern": "^[^\\u0000-\\u001f]+$",
            "description": "What this variant is called, e.g. \"Trans\"."
          },
          "colors": { "$ref": "#/properties/colors" },
          "icons": {
            "description": "The package's icon files are shared: a variant may set the style and colors, not images.",
            "allOf": [
              { "$ref": "#/properties/icons" },
              {
                "not": { "required": ["images"] }
              }
            ]
          },
          "background": { "$ref": "#/properties/background" },
          "splash": { "$ref": "#/properties/splash" },
          "shapes": { "$ref": "#/properties/shapes" },
          "components": { "$ref": "#/properties/components" },
          "layout": { "$ref": "#/properties/layout" }
        }
      }
    }
  },
  "definitions": {
    "schemaVersion": {
      "type": "integer",
      "minimum": 1,
      "maximum": 2147483647
    },
    "ratio": {
      "description": "Logical pixels, 0-40.",
      "type": "number",
      "minimum": 0,
      "maximum": 40
    },
    "borderWidth": {
      "type": "number",
      "minimum": 0,
      "maximum": 8
    },
    "elevation": {
      "type": "number",
      "minimum": 0,
      "maximum": 24
    },
    "size": {
      "description": "Logical pixels, 0-96.",
      "type": "number",
      "minimum": 0,
      "maximum": 96
    },
    "thickness": {
      "description": "Logical pixels, 0-16.",
      "type": "number",
      "minimum": 0,
      "maximum": 16
    },
    "inset": {
      "description": "[left, top, right, bottom], each 0-64 logical pixels.",
      "type": "array",
      "minItems": 4,
      "maxItems": 4,
      "items": {
        "type": "number",
        "minimum": 0,
        "maximum": 64
      }
    },
    "flag": { "type": "boolean" },
    "color": {
      "description": "An ARGB integer (0xAARRGGBB) or the name of a ColorScheme role.",
      "oneOf": [
        {
          "type": "integer",
          "minimum": 0,
          "maximum": 4294967295
        },
        {
          "enum": [
            "primary",
            "onPrimary",
            "primaryContainer",
            "onPrimaryContainer",
            "primaryFixed",
            "primaryFixedDim",
            "onPrimaryFixed",
            "onPrimaryFixedVariant",
            "secondary",
            "onSecondary",
            "secondaryContainer",
            "onSecondaryContainer",
            "secondaryFixed",
            "secondaryFixedDim",
            "onSecondaryFixed",
            "onSecondaryFixedVariant",
            "tertiary",
            "onTertiary",
            "tertiaryContainer",
            "onTertiaryContainer",
            "tertiaryFixed",
            "tertiaryFixedDim",
            "onTertiaryFixed",
            "onTertiaryFixedVariant",
            "error",
            "onError",
            "errorContainer",
            "onErrorContainer",
            "surface",
            "onSurface",
            "surfaceDim",
            "surfaceBright",
            "surfaceContainerLowest",
            "surfaceContainerLow",
            "surfaceContainer",
            "surfaceContainerHigh",
            "surfaceContainerHighest",
            "onSurfaceVariant",
            "outline",
            "outlineVariant",
            "shadow",
            "scrim",
            "inverseSurface",
            "onInverseSurface",
            "inversePrimary",
            "surfaceTint"
          ]
        }
      ]
    },
    "rgba": {
      "description": "ARGB integer. Palette values are integers rather than role names.",
      "type": "integer",
      "minimum": 0,
      "maximum": 4294967295
    },
    "palette": {
      "type": "object",
      "propertyNames": { "$ref": "#/definitions/roleName" },
      "additionalProperties": { "$ref": "#/definitions/rgba" }
    },
    "roleName": {
      "enum": [
        "primary",
        "onPrimary",
        "primaryContainer",
        "onPrimaryContainer",
        "primaryFixed",
        "primaryFixedDim",
        "onPrimaryFixed",
        "onPrimaryFixedVariant",
        "secondary",
        "onSecondary",
        "secondaryContainer",
        "onSecondaryContainer",
        "secondaryFixed",
        "secondaryFixedDim",
        "onSecondaryFixed",
        "onSecondaryFixedVariant",
        "tertiary",
        "onTertiary",
        "tertiaryContainer",
        "onTertiaryContainer",
        "tertiaryFixed",
        "tertiaryFixedDim",
        "onTertiaryFixed",
        "onTertiaryFixedVariant",
        "error",
        "onError",
        "errorContainer",
        "onErrorContainer",
        "surface",
        "onSurface",
        "surfaceDim",
        "surfaceBright",
        "surfaceContainerLowest",
        "surfaceContainerLow",
        "surfaceContainer",
        "surfaceContainerHigh",
        "surfaceContainerHighest",
        "onSurfaceVariant",
        "outline",
        "outlineVariant",
        "shadow",
        "scrim",
        "inverseSurface",
        "onInverseSurface",
        "inversePrimary",
        "surfaceTint"
      ]
    },
    "card": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "radius": { "$ref": "#/definitions/ratio" },
        "borderColor": { "$ref": "#/definitions/color" },
        "borderWidth": { "$ref": "#/definitions/borderWidth" },
        "backgroundColor": { "$ref": "#/definitions/color" },
        "elevation": { "$ref": "#/definitions/elevation" },
        "shadowColor": { "$ref": "#/definitions/color" },
        "surfaceTintColor": { "$ref": "#/definitions/color" },
        "margin": { "$ref": "#/definitions/inset" }
      }
    },
    "tile": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "radius": { "$ref": "#/definitions/ratio" },
        "borderColor": { "$ref": "#/definitions/color" },
        "borderWidth": { "$ref": "#/definitions/borderWidth" },
        "backgroundColor": { "$ref": "#/definitions/color" },
        "selectedTileColor": { "$ref": "#/definitions/color" },
        "textColor": { "$ref": "#/definitions/color" },
        "iconColor": { "$ref": "#/definitions/color" },
        "selectedColor": { "$ref": "#/definitions/color" },
        "padding": { "$ref": "#/definitions/inset" }
      }
    },
    "button": {
      "description": "Primary buttons: Material elevated and filled buttons, and Btn.elevated. The state tables merge with these values; per property the priority is disabled > pressed > hovered > focused > selected > base. minHeight needs schema 3.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "radius": { "$ref": "#/definitions/ratio" },
        "borderColor": { "$ref": "#/definitions/color" },
        "borderWidth": { "$ref": "#/definitions/borderWidth" },
        "backgroundColor": { "$ref": "#/definitions/color" },
        "elevation": { "$ref": "#/definitions/elevation" },
        "shadowColor": { "$ref": "#/definitions/color" },
        "surfaceTintColor": { "$ref": "#/definitions/color" },
        "foregroundColor": { "$ref": "#/definitions/color" },
        "overlayColor": { "$ref": "#/definitions/color" },
        "padding": { "$ref": "#/definitions/inset" },
        "minHeight": { "$ref": "#/definitions/size" },
        "disabled": { "$ref": "#/definitions/buttonState" },
        "pressed": { "$ref": "#/definitions/buttonState" },
        "hovered": { "$ref": "#/definitions/buttonState" },
        "focused": { "$ref": "#/definitions/buttonState" },
        "selected": { "$ref": "#/definitions/buttonState" }
      }
    },
    "buttonState": {
      "description": "One button state. Supports the same fields as components.button, without further nesting.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "radius": { "$ref": "#/definitions/ratio" },
        "borderColor": { "$ref": "#/definitions/color" },
        "borderWidth": { "$ref": "#/definitions/borderWidth" },
        "backgroundColor": { "$ref": "#/definitions/color" },
        "elevation": { "$ref": "#/definitions/elevation" },
        "shadowColor": { "$ref": "#/definitions/color" },
        "surfaceTintColor": { "$ref": "#/definitions/color" },
        "foregroundColor": { "$ref": "#/definitions/color" },
        "overlayColor": { "$ref": "#/definitions/color" },
        "padding": { "$ref": "#/definitions/inset" },
        "minHeight": { "$ref": "#/definitions/size" }
      }
    },
    "textButton": {
      "description": "Schema 3. Text buttons and Btn.text. Same fields and state tables as button.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "radius": { "$ref": "#/definitions/ratio" },
        "borderColor": { "$ref": "#/definitions/color" },
        "borderWidth": { "$ref": "#/definitions/borderWidth" },
        "backgroundColor": { "$ref": "#/definitions/color" },
        "elevation": { "$ref": "#/definitions/elevation" },
        "shadowColor": { "$ref": "#/definitions/color" },
        "surfaceTintColor": { "$ref": "#/definitions/color" },
        "foregroundColor": { "$ref": "#/definitions/color" },
        "overlayColor": { "$ref": "#/definitions/color" },
        "padding": { "$ref": "#/definitions/inset" },
        "minHeight": { "$ref": "#/definitions/size" },
        "disabled": { "$ref": "#/definitions/textButtonState" },
        "pressed": { "$ref": "#/definitions/textButtonState" },
        "hovered": { "$ref": "#/definitions/textButtonState" },
        "focused": { "$ref": "#/definitions/textButtonState" },
        "selected": { "$ref": "#/definitions/textButtonState" }
      }
    },
    "textButtonState": {
      "description": "One textButton state. Supports the same fields as components.textButton, without further nesting.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "radius": { "$ref": "#/definitions/ratio" },
        "borderColor": { "$ref": "#/definitions/color" },
        "borderWidth": { "$ref": "#/definitions/borderWidth" },
        "backgroundColor": { "$ref": "#/definitions/color" },
        "elevation": { "$ref": "#/definitions/elevation" },
        "shadowColor": { "$ref": "#/definitions/color" },
        "surfaceTintColor": { "$ref": "#/definitions/color" },
        "foregroundColor": { "$ref": "#/definitions/color" },
        "overlayColor": { "$ref": "#/definitions/color" },
        "padding": { "$ref": "#/definitions/inset" },
        "minHeight": { "$ref": "#/definitions/size" }
      }
    },
    "outlinedButton": {
      "description": "Schema 3. Outlined buttons. Same fields and state tables as button.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "radius": { "$ref": "#/definitions/ratio" },
        "borderColor": { "$ref": "#/definitions/color" },
        "borderWidth": { "$ref": "#/definitions/borderWidth" },
        "backgroundColor": { "$ref": "#/definitions/color" },
        "elevation": { "$ref": "#/definitions/elevation" },
        "shadowColor": { "$ref": "#/definitions/color" },
        "surfaceTintColor": { "$ref": "#/definitions/color" },
        "foregroundColor": { "$ref": "#/definitions/color" },
        "overlayColor": { "$ref": "#/definitions/color" },
        "padding": { "$ref": "#/definitions/inset" },
        "minHeight": { "$ref": "#/definitions/size" },
        "disabled": { "$ref": "#/definitions/outlinedButtonState" },
        "pressed": { "$ref": "#/definitions/outlinedButtonState" },
        "hovered": { "$ref": "#/definitions/outlinedButtonState" },
        "focused": { "$ref": "#/definitions/outlinedButtonState" },
        "selected": { "$ref": "#/definitions/outlinedButtonState" }
      }
    },
    "outlinedButtonState": {
      "description": "One outlinedButton state. Supports the same fields as components.outlinedButton, without further nesting.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "radius": { "$ref": "#/definitions/ratio" },
        "borderColor": { "$ref": "#/definitions/color" },
        "borderWidth": { "$ref": "#/definitions/borderWidth" },
        "backgroundColor": { "$ref": "#/definitions/color" },
        "elevation": { "$ref": "#/definitions/elevation" },
        "shadowColor": { "$ref": "#/definitions/color" },
        "surfaceTintColor": { "$ref": "#/definitions/color" },
        "foregroundColor": { "$ref": "#/definitions/color" },
        "overlayColor": { "$ref": "#/definitions/color" },
        "padding": { "$ref": "#/definitions/inset" },
        "minHeight": { "$ref": "#/definitions/size" }
      }
    },
    "iconButton": {
      "description": "Schema 3. Icon buttons. The fields and state tables of button, plus iconSize.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "radius": { "$ref": "#/definitions/ratio" },
        "borderColor": { "$ref": "#/definitions/color" },
        "borderWidth": { "$ref": "#/definitions/borderWidth" },
        "backgroundColor": { "$ref": "#/definitions/color" },
        "elevation": { "$ref": "#/definitions/elevation" },
        "shadowColor": { "$ref": "#/definitions/color" },
        "surfaceTintColor": { "$ref": "#/definitions/color" },
        "foregroundColor": { "$ref": "#/definitions/color" },
        "overlayColor": { "$ref": "#/definitions/color" },
        "padding": { "$ref": "#/definitions/inset" },
        "minHeight": { "$ref": "#/definitions/size" },
        "iconSize": { "$ref": "#/definitions/size" },
        "disabled": { "$ref": "#/definitions/iconButtonState" },
        "pressed": { "$ref": "#/definitions/iconButtonState" },
        "hovered": { "$ref": "#/definitions/iconButtonState" },
        "focused": { "$ref": "#/definitions/iconButtonState" },
        "selected": { "$ref": "#/definitions/iconButtonState" }
      }
    },
    "iconButtonState": {
      "description": "One iconButton state. Supports the same fields as components.iconButton, without further nesting.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "radius": { "$ref": "#/definitions/ratio" },
        "borderColor": { "$ref": "#/definitions/color" },
        "borderWidth": { "$ref": "#/definitions/borderWidth" },
        "backgroundColor": { "$ref": "#/definitions/color" },
        "elevation": { "$ref": "#/definitions/elevation" },
        "shadowColor": { "$ref": "#/definitions/color" },
        "surfaceTintColor": { "$ref": "#/definitions/color" },
        "foregroundColor": { "$ref": "#/definitions/color" },
        "overlayColor": { "$ref": "#/definitions/color" },
        "padding": { "$ref": "#/definitions/inset" },
        "minHeight": { "$ref": "#/definitions/size" },
        "iconSize": { "$ref": "#/definitions/size" }
      }
    },
    "input": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "radius": { "$ref": "#/definitions/ratio" },
        "borderColor": { "$ref": "#/definitions/color" },
        "borderWidth": { "$ref": "#/definitions/borderWidth" },
        "filled": { "$ref": "#/definitions/flag" },
        "fillColor": { "$ref": "#/definitions/color" },
        "focusedBorderColor": { "$ref": "#/definitions/color" },
        "errorBorderColor": { "$ref": "#/definitions/color" },
        "disabledBorderColor": { "$ref": "#/definitions/color" },
        "padding": { "$ref": "#/definitions/inset" }
      }
    },
    "search": {
      "description": "Schema 3. Search fields that draw their own pill: the settings search, the server switcher and the in-bar search. The field inside never takes the input component's border or fill.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "radius": { "$ref": "#/definitions/ratio" },
        "borderColor": { "$ref": "#/definitions/color" },
        "borderWidth": { "$ref": "#/definitions/borderWidth" },
        "backgroundColor": { "$ref": "#/definitions/color" },
        "elevation": { "$ref": "#/definitions/elevation" },
        "iconColor": { "$ref": "#/definitions/color" },
        "textColor": { "$ref": "#/definitions/color" },
        "hintColor": { "$ref": "#/definitions/color" },
        "height": { "$ref": "#/definitions/size" },
        "padding": { "$ref": "#/definitions/inset" }
      }
    },
    "navigation": {
      "description": "Applies to the bottom NavigationBar and the desktop NavigationRail.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "backgroundColor": { "$ref": "#/definitions/color" },
        "indicatorColor": { "$ref": "#/definitions/color" },
        "indicatorRadius": { "$ref": "#/definitions/ratio" },
        "selectedIconColor": { "$ref": "#/definitions/color" },
        "unselectedIconColor": { "$ref": "#/definitions/color" },
        "selectedLabelColor": { "$ref": "#/definitions/color" },
        "unselectedLabelColor": { "$ref": "#/definitions/color" },
        "elevation": { "$ref": "#/definitions/elevation" }
      }
    },
    "appBar": {
      "description": "Schema 3. The top bar of each page.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "backgroundColor": { "$ref": "#/definitions/color" },
        "foregroundColor": { "$ref": "#/definitions/color" },
        "titleColor": { "$ref": "#/definitions/color" },
        "iconColor": { "$ref": "#/definitions/color" },
        "elevation": { "$ref": "#/definitions/elevation" },
        "shadowColor": { "$ref": "#/definitions/color" },
        "surfaceTintColor": { "$ref": "#/definitions/color" }
      }
    },
    "segmented": {
      "description": "Schema 3. Segmented buttons and the app's own segmented tabs.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "radius": { "$ref": "#/definitions/ratio" },
        "borderColor": { "$ref": "#/definitions/color" },
        "borderWidth": { "$ref": "#/definitions/borderWidth" },
        "backgroundColor": { "$ref": "#/definitions/color" },
        "selectedColor": { "$ref": "#/definitions/color" },
        "textColor": { "$ref": "#/definitions/color" },
        "selectedTextColor": { "$ref": "#/definitions/color" }
      }
    },
    "sidebar": {
      "description": "Schema 3. Rows of the side bar and the settings menu.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "backgroundColor": { "$ref": "#/definitions/color" },
        "selectedColor": { "$ref": "#/definitions/color" },
        "textColor": { "$ref": "#/definitions/color" },
        "selectedTextColor": { "$ref": "#/definitions/color" },
        "iconColor": { "$ref": "#/definitions/color" },
        "selectedIconColor": { "$ref": "#/definitions/color" },
        "radius": { "$ref": "#/definitions/ratio" },
        "padding": { "$ref": "#/definitions/inset" }
      }
    },
    "dialog": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "radius": { "$ref": "#/definitions/ratio" },
        "borderColor": { "$ref": "#/definitions/color" },
        "borderWidth": { "$ref": "#/definitions/borderWidth" },
        "backgroundColor": { "$ref": "#/definitions/color" },
        "elevation": { "$ref": "#/definitions/elevation" },
        "shadowColor": { "$ref": "#/definitions/color" },
        "surfaceTintColor": { "$ref": "#/definitions/color" },
        "barrierColor": { "$ref": "#/definitions/color" },
        "insetPadding": { "$ref": "#/definitions/inset" }
      }
    },
    "sheet": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "radius": { "$ref": "#/definitions/ratio" },
        "borderColor": { "$ref": "#/definitions/color" },
        "borderWidth": { "$ref": "#/definitions/borderWidth" },
        "backgroundColor": { "$ref": "#/definitions/color" },
        "elevation": { "$ref": "#/definitions/elevation" },
        "shadowColor": { "$ref": "#/definitions/color" },
        "surfaceTintColor": { "$ref": "#/definitions/color" },
        "barrierColor": { "$ref": "#/definitions/color" },
        "dragHandleColor": { "$ref": "#/definitions/color" }
      }
    },
    "menu": {
      "description": "Schema 3. Popup and context menus.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "radius": { "$ref": "#/definitions/ratio" },
        "borderColor": { "$ref": "#/definitions/color" },
        "borderWidth": { "$ref": "#/definitions/borderWidth" },
        "backgroundColor": { "$ref": "#/definitions/color" },
        "elevation": { "$ref": "#/definitions/elevation" },
        "shadowColor": { "$ref": "#/definitions/color" },
        "surfaceTintColor": { "$ref": "#/definitions/color" },
        "textColor": { "$ref": "#/definitions/color" }
      }
    },
    "tooltip": {
      "description": "Schema 3.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "radius": { "$ref": "#/definitions/ratio" },
        "borderColor": { "$ref": "#/definitions/color" },
        "borderWidth": { "$ref": "#/definitions/borderWidth" },
        "backgroundColor": { "$ref": "#/definitions/color" },
        "textColor": { "$ref": "#/definitions/color" },
        "padding": { "$ref": "#/definitions/inset" }
      }
    },
    "toast": {
      "description": "Schema 3. Toasts and snack bars.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "radius": { "$ref": "#/definitions/ratio" },
        "borderColor": { "$ref": "#/definitions/color" },
        "borderWidth": { "$ref": "#/definitions/borderWidth" },
        "backgroundColor": { "$ref": "#/definitions/color" },
        "textColor": { "$ref": "#/definitions/color" },
        "elevation": { "$ref": "#/definitions/elevation" }
      }
    },
    "switch": {
      "description": "Schema 3. The selected* fields apply while the switch is on.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "thumbColor": { "$ref": "#/definitions/color" },
        "trackColor": { "$ref": "#/definitions/color" },
        "trackOutlineColor": { "$ref": "#/definitions/color" },
        "selectedThumbColor": { "$ref": "#/definitions/color" },
        "selectedTrackColor": { "$ref": "#/definitions/color" },
        "selectedTrackOutlineColor": { "$ref": "#/definitions/color" }
      }
    },
    "slider": {
      "description": "Schema 3.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "activeTrackColor": { "$ref": "#/definitions/color" },
        "inactiveTrackColor": { "$ref": "#/definitions/color" },
        "thumbColor": { "$ref": "#/definitions/color" },
        "overlayColor": { "$ref": "#/definitions/color" },
        "trackHeight": { "$ref": "#/definitions/thickness" }
      }
    },
    "progress": {
      "description": "Schema 3. Linear and circular progress indicators; radius applies to linear ones.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "color": { "$ref": "#/definitions/color" },
        "trackColor": { "$ref": "#/definitions/color" },
        "thickness": { "$ref": "#/definitions/thickness" },
        "radius": { "$ref": "#/definitions/ratio" }
      }
    },
    "badge": {
      "description": "Schema 3. Count badges, including the navigation rail's.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "backgroundColor": { "$ref": "#/definitions/color" },
        "textColor": { "$ref": "#/definitions/color" },
        "smallSize": { "$ref": "#/definitions/size" },
        "largeSize": { "$ref": "#/definitions/size" }
      }
    },
    "chip": {
      "description": "Schema 3.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "radius": { "$ref": "#/definitions/ratio" },
        "borderColor": { "$ref": "#/definitions/color" },
        "borderWidth": { "$ref": "#/definitions/borderWidth" },
        "backgroundColor": { "$ref": "#/definitions/color" },
        "selectedColor": { "$ref": "#/definitions/color" },
        "textColor": { "$ref": "#/definitions/color" },
        "padding": { "$ref": "#/definitions/inset" }
      }
    },
    "divider": {
      "description": "Schema 3. Dividers and hairlines.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "color": { "$ref": "#/definitions/color" },
        "thickness": { "$ref": "#/definitions/thickness" }
      }
    },
    "scrollbar": {
      "description": "Schema 3.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "thumbColor": { "$ref": "#/definitions/color" },
        "trackColor": { "$ref": "#/definitions/color" },
        "radius": { "$ref": "#/definitions/ratio" },
        "thickness": { "$ref": "#/definitions/thickness" }
      }
    },
    "brightnessGroup": {
      "description": "Brightness-specific tables. Only supplied fields override their common values, and button states merge too.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "card": { "$ref": "#/definitions/card" },
        "tile": { "$ref": "#/definitions/tile" },
        "button": { "$ref": "#/definitions/button" },
        "textButton": { "$ref": "#/definitions/textButton" },
        "outlinedButton": { "$ref": "#/definitions/outlinedButton" },
        "iconButton": { "$ref": "#/definitions/iconButton" },
        "input": { "$ref": "#/definitions/input" },
        "search": { "$ref": "#/definitions/search" },
        "navigation": { "$ref": "#/definitions/navigation" },
        "appBar": { "$ref": "#/definitions/appBar" },
        "segmented": { "$ref": "#/definitions/segmented" },
        "sidebar": { "$ref": "#/definitions/sidebar" },
        "dialog": { "$ref": "#/definitions/dialog" },
        "sheet": { "$ref": "#/definitions/sheet" },
        "menu": { "$ref": "#/definitions/menu" },
        "tooltip": { "$ref": "#/definitions/tooltip" },
        "toast": { "$ref": "#/definitions/toast" },
        "switch": { "$ref": "#/definitions/switch" },
        "slider": { "$ref": "#/definitions/slider" },
        "progress": { "$ref": "#/definitions/progress" },
        "badge": { "$ref": "#/definitions/badge" },
        "chip": { "$ref": "#/definitions/chip" },
        "divider": { "$ref": "#/definitions/divider" },
        "scrollbar": { "$ref": "#/definitions/scrollbar" }
      }
    }
  }
}

---

### Schemas Monitor App.Schema.Json (`docs/schemas/monitor-app.schema.json`)

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/lollipopkit/flutter_server_box/main/docs/schemas/monitor-app.schema.json",
  "title": "ServerBox Monitor web app manifest",
  "description": "store/apps/<publisher>.<name>/manifest.toml: a web service the Monitor agent deploys with Docker Compose and shows in a desk window. Read by monitor/src/stacks/manifest.rs; checked further by the serverbox-webapp skill's validate.py.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "publisher", "name", "project", "version", "homepage", "source", "glyph", "tone", "title", "description", "license", "compose"],
  "properties": {
    "schema": { "const": 1, "description": "Manifest format version." },
    "publisher": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_]{1,23}$",
      "description": "Who makes the service (`futo`). The app's id is <publisher>.<name>: stable, the folder's name; the compose project is sbm-<publisher>-<name>."
    },
    "name": { "type": "string", "pattern": "^[a-z][a-z0-9_]{0,23}$", "description": "The app's name within its publisher (`immich`)." },
    "project": { "type": "string", "minLength": 1, "maxLength": 64, "description": "The upstream project's name, as shown (`Immich`)." },
    "version": { "type": "string", "minLength": 1, "maxLength": 32, "description": "The upstream release the compose files pin." },
    "developer": { "type": "string", "minLength": 1, "maxLength": 128, "description": "Who makes the service, shown before deploying (`Immich (FUTO)`)." },
    "homepage": { "$ref": "#/$defs/url" },
    "source": { "$ref": "#/$defs/url", "description": "Where the service's source is." },
    "glyph": { "type": "string", "pattern": "^[a-z0-9_]{1,64}$", "description": "A Material Symbols Rounded name." },
    "tone": { "enum": ["berry", "soft", "ink", "sky", "teal", "violet", "amber", "leaf", "pale", "bright", "mist"] },
    "categories": {
      "type": "array",
      "uniqueItems": true,
      "items": { "enum": ["photos", "media", "files", "documents", "productivity", "development", "ai", "home", "network", "monitoring", "security", "tools"] }
    },
    "recommended": {
      "type": "boolean",
      "description": "A few of these are offered by the desk's first-run guide."
    },
    "notices": {
      "type": "array",
      "uniqueItems": true,
      "description": "What the deploy dialog points out about the compose files.",
      "items": { "enum": ["pullsImages", "buildsImages", "bindsPaths", "mountsHostFiles", "gpuDevices", "publishesPort", "privileged", "hostNetwork", "dockerSocket"] }
    },
    "title": { "$ref": "#/$defs/text", "description": "What the desk calls the window." },
    "description": { "$ref": "#/$defs/text" },
    "license": {
      "type": "object",
      "additionalProperties": false,
      "required": ["spdx", "url"],
      "properties": {
        "spdx": { "type": "string", "minLength": 1, "maxLength": 64 },
        "url": { "$ref": "#/$defs/url" },
        "accept": { "type": "boolean", "default": false, "description": "The admin must accept the licence before deploying." }
      }
    },
    "requirements": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "memory_min_mib": { "type": "integer", "minimum": 0 },
        "memory_recommended_mib": { "type": "integer", "minimum": 0 },
        "cores_min": { "type": "integer", "minimum": 0 },
        "arch": { "type": "array", "uniqueItems": true, "items": { "enum": ["amd64", "arm64", "arm"] } },
        "os": { "type": "array", "uniqueItems": true, "items": { "enum": ["linux", "macos", "windows"] } }
      }
    },
    "compose": {
      "type": "object",
      "additionalProperties": false,
      "required": ["files"],
      "properties": {
        "files": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": { "$ref": "#/$defs/file" },
          "description": "Compose files in merge order. Every other file in the folder is copied too (for extends)."
        },
        "jobs": {
          "type": "array",
          "uniqueItems": true,
          "items": { "type": "string", "minLength": 1 },
          "description": "Services that run once and exit (a migration): exited with 0 they are done, not down."
        }
      }
    },
    "web": {
      "description": "The page a window shows. Absent for a service with no page of its own, which then serves an [llm] endpoint.",
      "type": "object",
      "additionalProperties": false,
      "required": ["port"],
      "properties": {
        "port": { "$ref": "#/$defs/key", "description": "The key of the port setting the window reaches." },
        "path": { "type": "string", "pattern": "^/", "default": "/" },
        "basic_auth": {
          "type": "boolean",
          "default": false,
          "description": "The service asks for HTTP basic auth: the agent's proxy sends [login]'s user and password, so the desk's window opens signed in. Needs [login] user (no ':') and password."
        }
      }
    },
    "env": {
      "type": "object",
      "description": "Fixed values for the env file.",
      "propertyNames": { "$ref": "#/$defs/envName", "not": { "$ref": "#/$defs/reserved" } },
      "additionalProperties": { "$ref": "#/$defs/envValue" }
    },
    "login": {
      "type": "object",
      "additionalProperties": false,
      "minProperties": 1,
      "description": "How the admin signs in the first time, shown in the app's details.",
      "properties": {
        "user": { "type": "string", "minLength": 1, "maxLength": 64, "description": "The account the service is seeded with." },
        "password": { "$ref": "#/$defs/envName", "description": "The env name of the [[secrets]] entry holding its password, shown only when asked for." },
        "note": { "$ref": "#/$defs/text", "description": "What else the admin must know to sign in." }
      }
    },
    "mcp": {
      "type": "array",
      "maxItems": 4,
      "description": "The app's MCP servers (Streamable HTTP), which Agent mode connects to once it is deployed: the service's own, or a sidecar in the compose files.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["port", "path", "publisher"],
        "properties": {
          "port": { "$ref": "#/$defs/key", "description": "The key of the TCP port setting it listens on; Agent mode reaches it on this machine." },
          "path": { "type": "string", "pattern": "^/", "maxLength": 256 },
          "publisher": {
            "enum": ["builtin", "official", "community"],
            "description": "builtin: the service's own. official: the service's makers, apart from it. community: third-party code holding the service's credential, said so before deploying."
          },
          "service": { "type": "string", "pattern": "^[a-z0-9][a-z0-9_.-]{0,63}$", "description": "A sidecar's compose service: its image pinned by digest (@sha256:…), its port published on 127.0.0.1 alone. Not for builtin." },
          "source": { "type": "string", "pattern": "^https://", "description": "Where a sidecar's code is. Not for builtin." },
          "auth": {
            "type": "object",
            "additionalProperties": false,
            "description": "The header it is asked with, and one source of its value.",
            "properties": {
              "header": { "type": "string", "pattern": "^[A-Za-z0-9-]{1,64}$", "default": "Authorization" },
              "scheme": { "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9-]{0,31}$", "description": "Put before the value, such as Bearer." },
              "secret": { "$ref": "#/$defs/envName", "description": "A [[secrets]] entry: known at deploy, so it connects on its own." },
              "asked": { "$ref": "#/$defs/text", "description": "A token the admin gives once the service is set up: where to make one." },
              "oauth": { "const": true, "description": "Signed in with OAuth from Agent mode's settings." }
            },
            "oneOf": [{ "required": ["secret"] }, { "required": ["asked"] }, { "required": ["oauth"] }]
          }
        },
        "if": { "properties": { "publisher": { "const": "builtin" } } },
        "then": { "not": { "anyOf": [{ "required": ["service"] }, { "required": ["source"] }] } },
        "else": { "required": ["service", "source"] }
      }
    },
    "llm": {
      "type": "object",
      "additionalProperties": false,
      "required": ["port"],
      "description": "An OpenAI-compatible API serving a language model (a model server): Agent mode offers it as a provider once the app is deployed.",
      "properties": {
        "port": { "$ref": "#/$defs/key", "description": "The key of the TCP port setting it listens on; reached at http://127.0.0.1:<port><path>." },
        "path": { "type": "string", "pattern": "^/.*[^/]$", "default": "/v1", "description": "Where the API is: <path>/chat/completions, <path>/models." },
        "model": { "$ref": "#/$defs/key", "description": "The key of the text setting naming the model it serves, when it serves one." },
        "key": { "$ref": "#/$defs/envName", "description": "A [[secrets]] entry the API asks for as a bearer token." },
        "tools": { "enum": ["vllm", "sglang"], "description": "The engine whose tool-call parsers it takes: the agent writes SBM_TOOL_PARSER for the model `model` names (empty for a family it knows none for), for the compose file to pass on only when set. Needs model." }
      }
    },
    "secrets": {
      "type": "array",
      "description": "Generated once (alphanumeric) and kept in the env file.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["env"],
        "properties": {
          "env": { "$ref": "#/$defs/envName" },
          "length": { "type": "integer", "minimum": 16, "maximum": 128, "default": 32 },
          "bcrypt": { "$ref": "#/$defs/envName", "description": "An env name also given the secret's bcrypt hash, for a service that takes its first password hashed. The secret is then 72 characters at most." },
          "hex": { "type": "boolean", "default": false, "description": "Lowercase hex instead of letters and digits, for a key a service takes as hex; the length is then even." }
        }
      }
    },
    "settings": {
      "type": "array",
      "items": {
        "oneOf": [
          { "$ref": "#/$defs/pathSetting" },
          { "$ref": "#/$defs/portSetting" },
          { "$ref": "#/$defs/boolSetting" },
          { "$ref": "#/$defs/choiceSetting" },
          { "$ref": "#/$defs/textSetting" }
        ]
      }
    }
  },
  "$defs": {
    "url": { "type": "string", "pattern": "^https://", "maxLength": 512 },
    "file": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$" },
    "key": { "type": "string", "pattern": "^[a-z][a-z0-9_]{0,31}$" },
    "envName": { "type": "string", "pattern": "^[A-Z_][A-Z0-9_]{0,63}$" },
    "reserved": {
      "enum": ["SBM_UID", "SBM_GID", "SBM_TZ", "SBM_RENDER_GID"],
      "description": "Written by the agent for every app: the shared folder's owner, the host's time zone, and the GPU render node's group (SBM_GID without one). Used, never set."
    },
    "envValue": { "type": "string", "maxLength": 1024, "pattern": "^[^'\\n\\r\\u0000]*$" },
    "envMap": {
      "type": "object",
      "minProperties": 1,
      "propertyNames": { "$ref": "#/$defs/envName" },
      "additionalProperties": { "$ref": "#/$defs/envValue" }
    },
    "text": {
      "type": "object",
      "required": ["en"],
      "propertyNames": { "pattern": "^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$" },
      "additionalProperties": { "type": "string", "minLength": 1, "maxLength": 512 }
    },
    "common": {
      "type": "object",
      "required": ["key", "type", "label"],
      "properties": {
        "key": { "$ref": "#/$defs/key" },
        "label": { "$ref": "#/$defs/text" },
        "help": { "$ref": "#/$defs/text" }
      }
    },
    "pathSetting": {
      "allOf": [{ "$ref": "#/$defs/common" }],
      "unevaluatedProperties": false,
      "required": ["env", "default"],
      "properties": {
        "key": true, "label": true, "help": true,
        "type": { "const": "path" },
        "env": { "$ref": "#/$defs/envName" },
        "default": {
          "type": "string",
          "pattern": "^(/|\\{stack\\}|\\{shared\\})",
          "description": "Absolute, or under {stack} (the stack's directory) or {shared} (the folder every app shares: downloads, media/movies, media/tv, music, books, comics, documents)."
        },
        "data": { "type": "boolean", "default": false, "description": "Holds the service's data: removed only when the admin asks." }
      }
    },
    "portSetting": {
      "allOf": [{ "$ref": "#/$defs/common" }],
      "unevaluatedProperties": false,
      "required": ["env", "default"],
      "properties": {
        "key": true, "label": true, "help": true,
        "type": { "const": "port" },
        "env": { "$ref": "#/$defs/envName" },
        "default": { "type": "integer", "minimum": 1, "maximum": 65535, "description": "The next free port is offered when this one is taken." },
        "protocol": { "enum": ["tcp", "udp", "both"], "default": "tcp", "description": "What the port is published for; the window's port is TCP." }
      }
    },
    "boolSetting": {
      "allOf": [{ "$ref": "#/$defs/common" }],
      "unevaluatedProperties": false,
      "required": ["default", "on", "off"],
      "properties": {
        "key": true, "label": true, "help": true,
        "type": { "const": "bool" },
        "default": { "type": "boolean" },
        "on": { "$ref": "#/$defs/envMap" },
        "off": { "$ref": "#/$defs/envMap" }
      }
    },
    "choiceSetting": {
      "allOf": [{ "$ref": "#/$defs/common" }],
      "unevaluatedProperties": false,
      "required": ["default", "options"],
      "properties": {
        "key": true, "label": true, "help": true,
        "type": { "const": "choice" },
        "default": { "type": "string" },
        "options": {
          "type": "array",
          "minItems": 2,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["value", "label", "env"],
            "properties": {
              "value": { "type": "string", "pattern": "^[A-Za-z0-9._-]{1,64}$" },
              "label": { "$ref": "#/$defs/text" },
              "env": { "$ref": "#/$defs/envMap" },
              "suggest": {
                "type": "object",
                "additionalProperties": false,
                "description": "Offered as the default on a machine that matches.",
                "properties": {
                  "gpu": { "enum": ["nvidia", "amd", "intel"] },
                  "wsl": { "type": "boolean" }
                }
              }
            }
          }
        }
      }
    },
    "textSetting": {
      "allOf": [{ "$ref": "#/$defs/common" }],
      "unevaluatedProperties": false,
      "required": ["env", "pattern"],
      "properties": {
        "key": true, "label": true, "help": true,
        "type": { "const": "text" },
        "env": { "$ref": "#/$defs/envName" },
        "default": { "type": "string" },
        "optional": { "type": "boolean", "default": false, "description": "Left out of the env file when empty." },
        "pattern": { "type": "string", "description": "A regular expression the whole value must match." }
      }
    }
  }
}

---

### Crates Sbm Redfish Doc Vendors (`crates/sbm_redfish/doc/vendors.md`)

# What varies between vendors

Every entry here is something a client has to *discover* rather than assume.
Hardcode any of them and it works on the machine it was written against.

Two kinds of entry, kept apart on purpose:

- **Read** — from vendor documentation or a published mockup. Reliable about
  what a vendor says it does.
- **Measured** — observed on hardware listed under [Hardware this has run
  against](#hardware-this-has-run-against). These are the ones no amount of
  reading found.

## Resource ids are not stable — *read*

Supermicro uses `1`, Dell `System.Embedded.1`, OpenBMC `system`. None can be
derived from the others.

Walk `Systems` and `Chassis` and take what the collection lists. Never build a
path.

## There are two sensor models, and both may be present — *read*

Redfish 2020.4 deprecated `Thermal` and `Power` in favour of
`ThermalSubsystem`, `PowerSubsystem` and a unified `Sensors` collection.
Firmware follows unevenly — Supermicro switched at X14, so X11 through X13 are
still on the old one — and transitional firmware carries **both**.

Branch on which links the `Chassis` resource has. The new model wins where it
is fully present, which means `Sensors` *and* one of the two subsystems:
`Sensors` alone is not enough to read through the new path.

## `ResetType` is advertised, which is not the same as implemented — *read*

`ResetType@Redfish.AllowableValues` is a statement, not a guarantee. `Nmi` and
`PowerCycle` in particular are commonly listed and either unimplemented or
license-gated.

Negotiate an intent against the list with a fallback chain, and offer nothing
that maps to nothing. An operation with nothing behind it should not appear,
rather than appear and fail when pressed.

## `ResetType` may be a name the specification does not have — *measured*

An H3C R5350 G6 advertises `ForcePowerCycle`, which is not in the Redfish
`ResetType` enum, and advertises nothing else that cuts power. Matching only
standard names sent the power-cycle intent to `ForceRestart` — a different
operation.

Vendor names belong in the candidate chain, after the standard ones.

## A sensor with nothing to say may not say null — *measured*

The specification suggests `null`. Some firmware sends a sentinel instead. The
same H3C reports `4294967295` — `0xFFFFFFFF`, unsigned -1 — for every
temperature it cannot read, which was 18 of its 20.

Filter by plausibility rather than by matching known sentinels: the next
vendor's is `65535` or `127`, and a list of them is always one short. Nothing
real falls in the gaps — below absolute zero or above a thousand degrees is not
a chassis reading, and no fan turns at four billion RPM.

The limit is deliberate: `-1` is a sentinel for some firmware and is also what
a cold inlet reads, so it is kept. Deleting a real measurement to hide a fake
one is the worse of the two mistakes, and the only one nobody can see.

## Graceful operations are advisory — *read*

HPE documents that `GracefulShutdown` and `GracefulRestart` depend on the
operating system and that iLO does not distinguish them at the protocol level.
A `204` is acceptance, not a result.

Poll `PowerState` and report what it did, distinguishing *confirmed* from
*accepted*. A transitional state is not arrival.

## Sessions leak, and the limit is low — *read, and measured*

BMCs allow few concurrent sessions — about four is typical. Enough leaked ones
lock the management interface out until they time out or someone resets the
device by hand, and that failure looks like the device being broken rather than
like the client that caused it.

One login per client, `DELETE` on the failure path as much as the normal one,
and wait for a login still in flight before closing — otherwise the session it
is about to create is created after the delete.

## Licensing gates some of it — *read*

Supermicro's licenses gate firmware update and virtual media, not reads. A
`401` or `403` on a sub-resource is an ordinary answer about that resource, not
grounds to fail the whole fetch.

## The service root may not identify itself — *measured*

`Vendor` and `Product` are both absent on the H3C. They are free text and worth
displaying, but nothing may be decided by them.

## Logs are listed, never named — *read*

The machine's event log is `Systems/{id}/LogServices/EventLog` on OpenBMC,
`Managers/iDRAC.Embedded.1/LogServices/Sel` on iDRAC, `Systems/1/LogServices/IML`
on iLO; the BMC's own logs sit beside it under the manager. Walk both
`LogServices` collections. Order differs too (bmcweb oldest first, iDRAC newest
first), so entries are ordered by `Created` after reading, and a collection
may be one unpaged response of thousands or pages of ten. An oldest-first log
longer than the pages read is read from its tail by `$skip`. The next page's
link is `$skip`/`$top` (bmcweb, iDRAC), `page=N` (iLO) or `$skiptoken`.

## Virtual media may have no actions — *read*

`InsertMedia` and `EjectMedia` came with VirtualMedia 1.1 (2018); before it,
`Image` and `Inserted` were set with a `PATCH` (DMTF's `public-rackmount1`
mockup still has no actions). Use the action where the slot has one, the
properties otherwise. Newer firmware lists the slots under the system, older
under the manager.

## The locator has two names — *read*

`LocationIndicatorActive` (a boolean) replaced `IndicatorLED` (`Lit`,
`Blinking`, `Off`) in 2020. Set whichever the system reports; never both.
iLO's `IndicatorLED` takes `Lit` and not `Blinking`: `Lit` unless the
system's `AllowableValues` leave it out.

## Allowable values may be in an `ActionInfo` — *measured*

OpenBMC's bmcweb lists nothing inline on `#ComputerSystem.Reset`: the action
carries `@Redfish.ActionInfo` instead, and the `ResetType` parameter of that
resource holds the allowable values. A client that reads only
`ResetType@Redfish.AllowableValues` offers no power action on an OpenBMC
machine at all — which the Dart client did. Read the inline list, and the
`ActionInfo` when it is empty.

# Hardware this has run against

Two services, one of them emulated. This is what has answered, not what is supported — everything
marked *read* above comes from documentation, which is a different kind of
confidence.

| | |
| --- | --- |
| Model | H3C R5350 G6 |
| BIOS | 6.30.50 |
| Redfish version | 1.15.1 |
| `Vendor` / `Product` at the root | both absent |
| System id | `Systems/1` |
| Chassis id | `Chassis/1` |
| Sensor model | legacy. `Sensors` is linked but `ThermalSubsystem` is not |
| `ResetType` allowed | `ForceOff`, `ForcePowerCycle`, `ForceRestart`, `GracefulShutdown`, `Nmi`, `On` |
| Temperatures | 20 reported, 18 of them the `0xFFFFFFFF` sentinel |
| Fans | 8 positions, each reported twice with different readings — dual rotor, sharing a name |
| Chassis power | 48 W through `PowerControl` |
| Sessions | one open while one client is connected; released on close |
| Certificate | self-signed, within its validity dates |
| Run | 2026-08-23 |

| | |
| --- | --- |
| Model | OpenBMC `romulus` (AST2500), **emulated**: `qemu-system-arm -M romulus-bmc`, the OpenBMC CI `latest-master` image |
| Redfish version | 1.17.0 |
| `Vendor` / `Product` at the root | both absent |
| System id | `Systems/system` |
| Chassis id | `Chassis/chassis` |
| Sensor model | modern (`Sensors`, `ThermalSubsystem`, `PowerSubsystem`), no members — there is no host to measure |
| `ResetType` allowed | through `ResetActionInfo` only: `ForceOff`, `PowerCycle`, `Nmi`, `GracefulShutdown`, `On`, `ForceOn`, `GracefulRestart`, `ForceRestart` |
| Sessions | released on close |
| Certificate | self-signed (`CN=testhost`) |
| Logs | `EventLog` under the system (clearable), `Journal` under the manager (~850 entries, one unpaged response) |
| Clearing `EventLog` | answers `500 Base.1.19.InternalError` under QEMU, with or without a body |
| Boot override | targets `None`, `Pxe`, `Hdd`, `Cd`, `Diags`, `BiosSetup`, `Usb`; modes `Legacy`, `UEFI`; no allowable values for `BootSourceOverrideEnabled`. Set and read back |
| Locator | `LocationIndicatorActive`, set and read back |
| Storage | a `Storage` collection with no members; no `VirtualMedia` |
| Run | 2026-10-03; logs, boot override, locator 2026-11-14 |

Not covered, and worth a row when someone has one: Dell, OpenBMC on real hardware, the
Supermicro X13/X14 sensor-model switch, HPE iLO's graceful operations, and any
machine publishing more than one system.

**A run that finds nothing new is worth a row too.** That is how this stops
being one machine.

---

### Src Content Docs Changelog (`docs/src/content/docs/changelog.mdx`)

---
title: Changelog
description: What changed in each released version
---

## v1.0.1986 — 2026-12-01

### Added

- **Status tab:** the Server tab becomes the Status tab, listing servers and
  standalone BMCs together, with search, sorting, bulk selection and an
  automatic density that fits as many cards as the window shows.
- **Standalone BMCs:** add a BMC without a server, see its power, health and
  sensors on a card, power it on from there, and keep it in backups and shares.
- **Several SSH keys per server**, tried in the order you choose; a key that
  cannot be loaded no longer stops the others, and password or agent
  authentication still follows.
- **Linux `.deb`, `.rpm` and portable `.tar.gz`** downloads next to the
  AppImage, and Windows installation through Scoop.
- The Gruvbox themes in the theme store.
- A server setting for the maximum number of connection retries.

### Changed

- The backup and sync settings are reorganized.
- Container stats now include network and disk I/O totals; unavailable values
  show as unavailable instead of zero.
- Upgraded to Flutter 3.50.1.

### Fixed

- A WebDAV remote whose setup failed can be edited or removed again, and a
  failed setup leaves automatic sync off.
- Servers that only accept SHA-1 `ssh-rsa` signatures connect again when
  legacy algorithms are enabled.
- Commands on Windows servers decode their output correctly, and `sudo` prompts
  are handled.
- The app switcher privacy blur stays per device instead of following a
  restored or synced backup.
- A BMC power action confirmed after the BMC was removed is cancelled.
- Choosing a folder on desktop when exporting data or saving a poster, and
  full-screen and tray close handling on desktop.

## v1.0.1962 — 2026-11-23

### Added

- **MCP server in the app and on Monitor:** expose ServerBox hosts and settings
  through a local MCP server in the app, and expose an authenticated MCP
  endpoint on Monitor with scoped API tokens and per-IP / per-token rate
  limiting.
- **Expanded BMC (Redfish) management:** read and clear event logs, inspect
  drives and predictive failure status, set boot device overrides, mount or
  eject virtual media, and toggle the locator LED.
- **SSH agent and jump-host multiplexing:** authenticate using keys from the
  system `ssh-agent`, forward the agent to terminal sessions, and connect
  through a jump host's existing OpenSSH ControlMaster.
- **Agent secret redaction:** automatically redact sensitive tokens, keys and
  passwords before the Agent sends context to a model.
- **Monitor fallback address and per-device metric history:** configure a
  fallback address for Monitor connections, and query per-device metrics history
  over custom time ranges.
- **Server status sharing and swap breakdown:** share a server's live status as
  a poster image or formatted text, and inspect each swap area's size, usage and
  priority individually.

### Changed

- **macOS builds are now unsandboxed only:** Mac App Store builds and sandbox
  compatibility branches have been removed.
- **iOS local Linux environment** migrated to the new userland engine (`iul`).
- **Unified UI interactions:** dialogs replaced with bottom sheets across the
  app, a single server picker with search, tags and sorting used everywhere, and
  the bottom bar adapts the number of visible tabs to the window width.
- **Agent chat:** tool calls now fold neatly with improved scroll following.
- Older app builds can now open local storage databases written by newer schema
  steps they understand.
- Upgraded to Flutter 3.50.

### Fixed

- Read CPU temperatures from `hwmon` in addition to thermal zones.
- Keep Agent replies intact across dropped connections and request iOS
  background execution time while a reply is streaming.
- Deduplicate virtual media slots when a Redfish service lists the same slot
  twice.
- Align server list titles properly with non-square distribution marks.
- Prevent background sync and connection teardown from blocking UI dismissal.
- Keep the theme background steady beneath pages during route transitions.
- Respect the wake-lock setting in terminal sessions.

## v1.0.1925 — 2026-11-11

### Before you upgrade

- **Usage analytics are removed**, along with the Full diagnostics level.
  Installations set to Full now use Basic, which uploads only errors and
  crashes.
- **Monitor v0.4.0 uses a single account and signs in with a password only.**
  Signing in grants the permissions of the system account Monitor runs as;
  roles, per-feature permissions, file roots and read-only mode are removed. On
  upgrade, the oldest admin account is kept and other accounts' tasks, memory
  and desk data move to it. ServerBox no longer asks for a username, and offers
  to update Monitors older than v0.4.0 before signing in.
- **Self-signed Monitor certificates are trusted once by fingerprint.** The
  "ignore certificate" toggle is replaced by SHA-256 fingerprint pinning: the
  first connection prompts you to trust the certificate from the server card or
  detail page, and prompts again only if the certificate changes.
- **Sync uses a new incremental format.** iCloud and WebDAV now sync individual
  changes instead of full backups, encrypted with a sync key protected by your
  backup password. GitHub Gist and Monitor's hosted backup store are removed as
  sync destinations. All devices sharing a destination must use the same backup
  password and upgrade to this version; older versions cannot read changes
  written by newer ones.
- **The Monitor panel's terminal no longer connects over SSH.** It opens a local
  shell directly under the system account Monitor runs as.
- New Monitor panel features, the Monitor tab's management views, and the new
  notification channels require **Monitor v0.4.0**.

### Added

- **Storage and sharing** in the app and the Monitor panel: manage disks,
  partitions, RAID arrays, ZFS pools, LUKS encryption and SMART health, plus
  SMB shares (with Time Machine and recycle bin options) and NFS exports.
- **Monitor panel redesigned as a desktop:** every feature opens in its own
  window, with a menu bar, dock, Spotlight search, notification center, tabs and
  split panes in Terminal and Files, and customizable wallpapers and themes.
- **Expanded server tools in the Monitor panel:** processes, services, scheduled
  tasks, containers (images, logs, container shell, and scheduled volume and
  folder backups), system users and groups, snippets, firewall, benchmark, tmux,
  iperf, file editor, remote desktop (VNC and RDP), virtualization and BMC
  (Redfish).
- **App Store for self-hosted web apps:** deploy and update over 40 Docker
  Compose services from the Monitor panel (including Immich, Jellyfin,
  Nextcloud, Vaultwarden, Home Assistant, Gitea, Open WebUI, Grafana and n8n),
  or load custom catalogs and local Compose apps, with port checks, health
  alerts, a shared media folder and built-in reverse proxy access.
- **Desk apps (`.fsba`) in the Monitor panel:** install sandboxed third-party
  panel apps with approved permissions, alongside signed official packages for
  **Local inference** (Ollama, llama.cpp, vLLM, SGLang and MLX matched to the
  machine's GPU), **AI agents** (Codex, Claude Code, pi, opencode, Hermes and
  OpenClaw), **Reverse proxy and WAF** (nginx, Caddy, Traefik, and ModSecurity
  with OWASP CRS), **Tailscale**, **Kernels**, **Ubuntu Pro** and **Cleanup**.
- **Agent mode on Monitor, integrated with the app:** run AI tasks on Linux,
  macOS and Windows servers with per-task model, thinking level and permission
  mode, execution plans, command risk checks, sudo prompts, attachments, memory,
  MCP servers (with OAuth and deployed apps' MCP servers) and skills. Tasks can
  also be started, followed live and answered from the app's Agent tab.
- **Agent command permissions:** choose Manual, Auto or Allow all mode and
  configure allow, ask or deny command rules for both the on-device Agent and
  Monitor's Agent mode.
- **Monitor tab, one-click updates and settings backup:** view all connected
  Monitors at a glance—version status and one-click updates, active alert rules,
  deployed web apps (with available updates listed first) opened through
  Monitor's proxy, notifications, per-server audit logs, and signed-in sessions
  and trusted devices that can be revoked. Each server page also lists its own
  web apps, and Monitor can back up its settings to WebDAV as `age`-encrypted
  archives.
- **ServerBox OS (`sbOS`) bootable images:** live and disk-installable images
  based on Alpine Linux (`musl`) and Debian 13 (`GNU`) for `x64` (BIOS and UEFI)
  and `arm64` (UEFI), with Monitor and Docker preconfigured.
- **Server discovery:** find SSH servers on the local network, in SSH config
  files, on Tailscale and through Cloudflare Tunnel, and add them along with
  their jump servers. First-run setup is redesigned around it.
- **Selective sync and full user-data coverage:** toggle sync separately for
  settings, AI preferences, credentials, key passphrases, files and benchmarks;
  fonts, images, skills, theme packages and icon packs now sync as well. The
  redesigned sync page shows each destination's live status.
- **Trusted sign-in devices on Monitor:** devices that have signed in before
  receive a device token, so failed sign-in attempts from other sources do not
  lock them out.
- **New notification channels:** SMTP email, Telegram, Discord and ntfy, plus
  `${ENV}` variable references for push credentials in `config.toml`. Bark adds
  subtitle, Markdown, critical alert volume, badge, image, copy, archive options
  and AES-CBC encrypted push.
- **GPU process list** for servers connected through Monitor.
- **iOS:** device files and installed Linux environments appear in the Files
  app, and Paste from the system menu uses bracketed paste in the terminal.
- **Windows installer (`.exe`):** per-user installer that requires no
  administrator rights and bundles the Visual C++ runtime, alongside WinGet
  support. The portable `.zip` archive remains available.
- **tmux:** zoom and unzoom panes, keeping zoom active when switching panes.
- **Redesigned full-screen server view** across all platforms, showing a single
  server or all servers with burn-in protection.

### Changed

- Exported backups now use the `age` format and can be decrypted with `age -d`
  using your backup password; older backups still restore. On Monitor, stored
  credentials and Agent mode chats are now encrypted at rest.
- Terminal and file tabs are no longer reopened automatically after closing the
  app.
- Improved mouse wheel and trackpad scrolling in the terminal, with whole-line
  wheel steps, smooth trackpad scrolling in full-screen programs and a single
  scrollbar.
- Notification channel editors now show every option a channel type supports,
  including unset fields.
- Percentage chart axes no longer extend past 100%.
- Completed and polished translations across all supported languages in the app,
  Monitor panel and documentation.

### Fixed

- macOS: fixed garbled text on Intel Macs (#1798) by switching the Intel DMG
  build to the Skia renderer.
- Database: fixed a migration failure when opening databases from older releases
  (prior to schema v31), and added retries for transient I/O errors when opening
  the database on Windows.
- tmux: fixed pane and window target resolution, cross-window switching, clean
  detaching, live screen tracking on pane switches, and output replay after
  reconnecting.
- Terminal: typing quickly no longer duplicates characters; opening a session
  from the picker switches to its tab; replacing the background image takes
  effect immediately; and the Files button resolves the shell's working
  directory without typing commands into the shell.
- Editor: copying a large selection while an input method is active no longer
  drops lines.
- Settings and navigation: pages with unsaved edits ask before closing, and Back
  navigation returns to the visible page across tabs, workspace panes and wide
  windows.
- Dialog buttons remain responsive after the window is resized or the screen
  rotates.
- Mobile: fixed Paste in text fields and the terminal on iOS, merged foreground
  session notifications, and fixed keyboard bounce when switching views.
- Remote desktop now shows a clear explanation when a server supports only
  Standard RDP Security.
- Monitor: Linux builds start on CPUs without AVX; NVIDIA GPU processes are
  listed again when the driver does not report per-process memory (Windows and
  WSL); notification channel errors no longer expose request URLs that could
  contain tokens; and newly installed Monitors no longer send alerts to blank
  placeholder channels.

## v1.0.1856 — 2026-11-01

### Added

- **All Linux block devices in server details:** the disk dialog lists every
  disk and partition, including unmounted and blank ones, with model, size,
  type, transport and file system. The Monitor panel shows them too (agent
  v0.3.0).
- **Android:** a redesigned, resizable home-screen widget; server shortcuts;
  a Quick Settings sessions tile; sharing text and files from other apps into
  a snippet or server; keyboard shortcuts; Live Updates; per-app language in
  system settings; and widget previews in the launcher.
- **File editing on Monitor-only servers and this device,** as on SSH servers.
  If a file changes on the server while open, saving asks before overwriting it.
- Persian (فارسی), the first right-to-left language.

### Changed

- AI settings now appear at the top level of Settings.
- The Wiki link is removed from About and the macOS menu.
- Translations revised in all languages, including the Android widget, the
  store listing, the Monitor panel and the website.
- Monitor agent v0.3.0 uses ntex 4.

### Fixed

- Editor select-all with an input method and cursor movement across lines.
- The "clear all settings" button no longer appears on settings sub-pages,
  where it could reset the language and first-run setup.
- WebDAV restore no longer fails when a file name contains a `%`.
- Android no longer treats a session stopped on purpose as a lost connection.
- Monitor agent v0.3.0 on Windows no longer crashes about 20 seconds after
  starting as a service or over SSH. Timed-out commands now end with all their
  child processes.

## v1.0.1844 — 2026-10-30

### Added

- **SSH host certificates:** connect to servers that present only a host
  certificate, and trust host certificate authorities by host pattern in
  Settings → SSH, as with OpenSSH's `@cert-authority`.
- **Encrypted key passphrases are remembered** in this device's system
  keychain, so they are not asked for after a restart. The key itself stays
  encrypted, including in backups. The key editor shows the saved passphrase
  after app-lock authentication. Turn it off in Settings → SSH.
- Agent: a conversation can include what is on screen, such as the selected
  server's status, containers, processes, services, terminal or file view.

### Changed

- SSH connections using AES-GCM are faster, including file transfers.
- The selection tab in Terminal, Files and Remote desktop is now named
  "Select" and no longer looks like a button.
- BMC: power controls show an action in progress and prevent overlapping
  ones; BMC and virtualization settings ask for the password again when the
  address changes.

### Fixed

- Text selection in full-screen terminal programs follows whether the
  program uses the mouse.
- The terminal's long-press menu works again.
- A failed reconnect no longer closes the connection the server status uses.
- BMC: the first status read after opening works, and refreshes keep the
  system details already found.
- When the app cannot read its data because the stored key is lost or
  rejected by the system keystore, it says why and offers to retry or start
  without data, instead of failing to start; the page also mentions keystore
  modules on rooted Android devices.
- Monitor: russh 0.64.1 for a security advisory (not reachable in the agent).

## v1.0.1816 — 2026-10-20

### Added

- **Icon packs:** icons chosen apart from the theme, and themable icons in the
  Files window, looked up by file extension.
- **Markdown preview:** Markdown files open rendered in the file editor, with
  an Edit button for the source.
- **Reconnect button in the terminal,** for a connection that looks alive but
  no longer answers.
- **System groups** beside system users, in the app and the Monitor panel.
- **Screen reader support:** terminal content can be read aloud, benchmark
  logs are available as text, icon-only buttons have accessible names, and the
  Monitor panel can be used with a keyboard and a screen reader. The panel's
  terminal reader mode is opt-in.
- The app and the Monitor agent check that they speak the same protocol
  version, and say which one needs updating when they do not.

### Changed

- Saved private keys are hidden by default in the editor and can be shown after
  app-lock authentication.
- Agent: thinking levels follow the selected model, and favorites and the
  composer show which provider a model is from.

### Fixed

- Remote desktop: KDE Plasma's built-in RDP server (krdp) no longer
  disconnects right after login, and xrdp logs on with the saved password
  instead of showing its own login screen.
- Server details: cards with more than six rows (sensors, GPUs, batteries, BMC,
  custom commands, disk health) can show every row.
- When the status script cannot be placed in `/tmp`, the fallback directory in
  the user's home now works. Memory that could not be read shows the reason
  instead of "100% of 1024 B".
- Monitor: disks are read on machines whose language is not English.
- A launch that fails shows why instead of opening no window, and an
  unreadable preferences file no longer stops the app from starting. On
  Windows and Linux, preferences are written atomically, so an interrupted
  write no longer damages them.

## v1.0.1787 — 2026-10-16

### Added

- **Server readings below the terminal:** an optional bar with the server's
  CPU, memory, network and disk, above the virtual keys on a phone. Turn it on
  in Settings → SSH, or from the terminal tab's menu.

### Changed

- Bottom sheets can be resized by dragging, pickers open as sheets on phones,
  and network direction arrows now appear before their values.
- Updated the IronRDP dependency used by remote desktop.

### Fixed

- Android: the notification shows the app's glyph instead of a solid ring.
- Long Agent chats can be opened again. Their messages are stored in SQLite
  and loaded a page at a time.
- Fixed terminal buffer gaps and stale lines after resizing or scrolling.
  Virtual Ctrl, Alt, and Shift keys now retain their pressed state.
- Desktop: Settings opened from the tray appears beside the rail instead of
  covering the window, and can be closed normally.
- Windows: installing the status script no longer fails when the exit status
  arrives after the output has ended.
- Closing a workspace no longer errors while one of its shells is shutting
  down.

## v1.0.1773 — 2026-10-13

### Added

- **Workspace tab:** terminals and other server pages side by side in split
  panes, with typing sent to several terminals at once, saved layouts and
  customizable keyboard shortcuts.

### Changed

- Beta features are marked the same way on every page.

### Fixed

- Android: Linux installations now preserve hard links and read-only
  directories; temporary files go to /tmp.
- Connections dropped while the app is in the background are detected and
  reconnected instead of left hanging. On iOS, a file transfer keeps running
  for a while after the app leaves the foreground.
- The terminal's Agent panel stays above the keyboard and shows when a reply
  is being written.
- Swiping back from a page on one tab no longer opens the keyboard for a
  terminal on another.
- Diagnostics are uploaded only after you choose a level.

## v1.0.1765 — 2026-10-12

### Added

- **Firewall management** for ufw and firewalld: view and edit rules and
  zones, with checks that warn before a change would lock you out of SSH.
- **Program status in the terminal:** progress (OSC 9;4), command start and
  finish (OSC 133) and program status (OSC 7501) are shown on the session,
  with an optional notification when a long command finishes.
- **Terminal line height** setting; the terminal settings show which font is
  in use.
- **Network traffic** beside speed on the server page, with every interface
  selectable; the CPU row shows the thread count and per-thread usage.
- A per-server option to count network filesystems in the disk total.

### Changed

- **Tabs on narrow screens share the same top bar**, which stays clear of the iPadOS
  window controls.
- **Server rows in every side list look the same** (server, terminal, files,
  remote desktop): the distribution icon with a status dot, or a status bar
  when the icon is hidden.
- Home page charts load faster.
- Disks are read from both lsblk and df, so the disk list and disk total match
  on every page.
- Memory in use no longer counts the page cache.
- ARM CPUs show their manufacturer and model, and every core type is listed.

### Fixed

- Fixed a launch failure in Italian, Korean and Azerbaijani.
- A terminal opened at launch failed when the server refused the first
  connection; it now retries.
- A terminal restored on another tab took the focus and the keyboard.
- Stopping the Agent now ends a running command at once.
- Agent replies and their code can be selected on every platform.
- Remote desktop: keyboard input, long press and VNC passwords.
- Themes are included in backups.
- A fully charged battery no longer triggers an alert; a low battery does
  when the device is running on battery power.
- Hosts without `/etc/hostname` now show a name.

## v1.0.1719 — 2026-10-01

### Before you upgrade

- **Previous Agent conversations are removed.** The new Agent engine cannot
  use the old conversation history, which was not included in backups.
- **Some settings have been removed**, including the old CPU and network
  display options, server history, card ordering, custom theme catalog URL,
  and opening terminals in the system SSH app. Terminals now always open in
  ServerBox.
- **Some Monitor features require agent 0.2.0**, including accounts and roles,
  port forwarding, longer history and Monitor settings. When upgraded, existing
  accounts become admins with permissions based on the old access settings.

### Added

- **Remote desktop:** Connect to servers with RDP or VNC through SSH or a
  Monitor agent, without exposing the desktop port. Multiple connection
  profiles are supported. Password saving is optional; audio, multiple
  monitors and file transfer are not supported.
- **Virtualization:** Manage Proxmox VE and libvirt/KVM virtual machines and
  containers, including power, console, snapshots, storage and networks.
  Proxmox settings are carried over from the server page.
- **Use this device as a server** on Linux, Windows and the macOS DMG build,
  with status, processes, services, containers, terminal and files.
- **Themes and a theme store:** Install official themes or import `.fsbt`
  packages. Existing AMOLED modes are converted to the AMOLED theme.
- **Port forwarding** through a Monitor agent, including local, remote and
  SOCKS5 forwarding. SSH also supports SOCKS5 forwarding.
- **Monitor accounts, roles and settings** can be managed in the app, including
  access permissions, collection, alerts, data retention and notifications.
- **`serverbox://` links** can open servers, features and snippets or prefill
  a new server. Links do not include passwords or keys, and snippets ask
  before running.
- **ProxyCommand on Android and iOS**, plus access to installed Linux files
  from Android's file picker.
- **More monitoring data**, including GPU, disk, network, battery, sensor and
  SMART readings, with up to 30 days of agent history.
- **App-drawn tmux controls, reduced motion, improved terminal reconnection**
  and support for older SSH servers are also available.

### Changed

- **Server and settings pages have a new layout**, with searchable settings,
  server search and sorting, clearer status information and a more compact
  phone navigation bar.
- **Server connections are easier to manage:** SSH and Monitor can be enabled
  separately and ordered as preferred or fallback connections.
- **The Agent has a new engine** with provider and tool choices, separate app
  and terminal conversations, image attachments and optional automatic
  approval for commands judged safe.
- **Server management pages are improved** for containers, users, processes,
  services and scheduled tasks. Services can be managed without opening a
  terminal, and process and task lists are easier to inspect.
- Files in the old device Documents location are copied to the new app storage
  location; the originals remain in place.

### Fixed

- Fixed process controls and status readings on Linux, Windows, macOS and BSD.
- Fixed user and scheduled task pages on servers using fish or BusyBox.
- Fixed backup restore and import issues, including duplicate server names
  and older keys; server renames now keep benchmark history.
- Fixed settings sync, server sorting, SSH connection cleanup and several
  crashes caused by unexpected server responses.
- Fixed Monitor agent hangs and alert rules that missed data or did not run.

## v1.0.1617 — 2026-09-12

### Added

- **One macOS build per architecture.** Apple silicon gets
  `ServerBox-<version>-arm64.dmg` and Intel gets `ServerBox-<version>-amd64.dmg`.
  The App Store build supports Apple silicon only. All macOS builds now require
  macOS 13 or later.
- **Users and scheduled tasks.** Two new entries in a server's function row.
  *Users* creates, edits and removes system accounts — UID, primary and
  supplementary groups, login shell, home directory, password. *Scheduled
  tasks* reads and writes crontabs, keeping comments, environment variables and
  lines it does not recognise. Both run through `sudo`, and both support Linux
  servers only.
- **A switch for Live Activities**, at **Settings → App → iOS → Live Activity**
  and off by default. Previously one appeared whenever a terminal connected,
  with nothing to turn it off.
- Azerbaijani (`az`).

### Changed

- **You now specify the API version in the Agent endpoint.** The app no
  longer inserts `v1` into an address that lacks it, which broke providers
  such as Zhipu (`/api/paas/v4`). Upgrading writes the old guess into stored
  values, so an existing setup keeps working.
- **Long Agent conversations are summarised** rather than dropped.
  **Settings → App → AI** gained *Summarise at* and *Context size*, and a
  *Model table* fed from models.dev.
- **Plain-HTTP AI endpoints can be allowed** at
  **Settings → App → AI → Allow plain HTTP**, for a self-hosted Ollama or vLLM
  on a LAN. The API key and any terminal context are sent unencrypted;
  localhost is unaffected.
- The pre-release update switch is now *Receive pre-release updates*, and the
  raw JSON editor is no longer in release builds.

### Fixed

- **Server-sharing QR codes can be scanned.** The payload was not
  compressed, so a server carrying a key produced a symbol up to 177 modules
  across that a scanner could not read. It is deflated before encrypting now,
  at a lower error-correction level and a hard size cap.
- **Turning off the app lock requires authentication.** The check never
  worked — the new value was written whether or not the prompt succeeded, so
  removing the lock took no authentication at all.
- **A downgraded install shows a way out.** A build older than its data used
  to stop before drawing anything: no window, no message, the reason only in a
  log the user could not reach. It now names both versions and offers an
  encrypted backup, an unencrypted export, or deleting all data.
- **Devices without biometric authentication no longer lock users out.**
  Restoring a backup onto hardware without biometrics left the lock screen
  with nothing to open it and the settings switch hidden, so the app was
  unusable and the control that would fix it was missing.
- **Agent turns with several tool calls no longer break the conversation.**
  Calls left unanswered meant more tool results than the API accepts, which
  rejected the whole request. Each skipped call now returns an explicit
  result.
- Agent command previews no longer draw over their own **Allow**/**Deny**
  buttons.

## v1.0.1574 — 2026-09-06

### Added

- **Globe view.** A globe button above the server list draws servers where
  their addresses resolve to. Placement needs a city dataset of about 25 MB
  that is not bundled and is never downloaded on its own — the confirmation
  dialog quotes the current sizes first. Servers that cannot be placed sit in a
  strip below, labelled *Private address* or *No location data*, and a manually
  entered coordinate beats every automatic source. Addresses are never sent to
  a geolocation service. See [Globe view](/docs/advanced/globe/).
- **Benchmark.** Runs Yet Another Bench Script on a server and keeps
  structured, comparable results. A full run takes 10–20 minutes and continues
  if you leave the page or close the app. Geekbench is off by default, since it
  downloads a proprietary binary and publishes the result to a public page;
  the iperf run is reduced and IP lookup is off, for the same reason.
- **A status icon on desktop.** The macOS menu bar, the Windows tray and the
  Linux panel show one row per server with a state glyph, readings and a
  sparkline. Linux shows a single line and no chart.
- **Share a server to another device.** A server record — including a private
  key held in the key store — travels as a QR code or as a `.sbxsrv` file. The
  QR carries a 6-digit one-time code shown separately and expires after 10
  minutes; the file uses a passphrase you choose and does not expire. Jump
  servers, key file paths and BMC credentials are not included.
- **Crash reports.** After a crash, **Settings → App → Privacy → Crash report**
  appears when a report is available. Reports are not uploaded automatically;
  you can delete one, copy it, or copy it and open a GitHub issue. Automatic
  uploads are controlled by the separate *Diagnostic data* setting. Known
  server names, addresses, and usernames are replaced with placeholders.

### Changed

- **The list column folds away, and search stays in place.** Search no longer
  opens a page over the list; it replaces the switcher in the bar and filters
  results as you type. The server list can be ordered by name or
  by connection state, and the default stays the order set on the settings
  page.
- **Virtual filesystems no longer appear in the disk list.** Snap revisions,
  swap areas, container layers and `fuse-overlayfs` are excluded, and a disk's
  source is judged separately from its filesystem type — a ZFS pool named
  `tmpfspool` is storage, not a filesystem to hide.

### Fixed

- Restored the missing virtual key options in the terminal.
- Geo data updates and globe refreshes are hardened against a failed or partial
  download.

## v1.0.1553 — 2026-08-29

### Changed

- **Remote backups require a backup password.** Uploading to iCloud, WebDAV or
  Gist with an empty password is refused, and so is deleting the password while
  any remote sync is on. An existing unencrypted remote backup still restores
  and is replaced by an encrypted one on the next upload. Local file and
  clipboard backups can still be left unencrypted.
- **Services replaces the Systemd page** and detects the manager installed on
  the server: systemd, procd or OpenRC. s6, runit, upstart, launchd and sysvinit
  are detected and reported as unsupported. Actions on procd and OpenRC units
  always need root; systemd needs it only for system-scope units. Where the
  account has no user session bus, only system units are listed and the page
  says so.
- **SSH cryptography moved to Rust.** The record cipher and the per-connection
  cryptography (x25519, Ed25519 and ECDSA, bcrypt_pbkdf) no longer run on the
  frame-drawing isolate. Measured on AOT, the record layer went from 15 to
  486 MB/s at 32 KiB packets, Ed25519 verify from 1.215 ms to 0.019 ms, and
  ECDSA P-256 verify from 3.900 ms to 0.084 ms. Parsed private keys are also
  cached across connections now. AES-GCM, ChaCha20-Poly1305 and RSA stay on the
  Dart implementation.

### Fixed

- On Android, system Back inside a terminal no longer closes the whole
  terminal, and the foreground service is serialized so an empty session list
  cannot start and stop it in the same breath — which Android 16 could treat as
  a broken contract and kill the app over.
- Server refreshes no longer overlap at startup. Startup, lifecycle handling
  and the auto-refresh timer could each start their own pool, multiplying
  concurrency; one scheduler owns the queue now.
- A false *incomplete* verdict on SSH command output is gone, and the container
  page hides partial output instead of presenting truncated stdout as the
  reason something failed.
- Settings and Logs back navigation pops one level instead of leaving the
  section.
- The foreground service no longer re-requests notification permission on
  every session sync.

## v1.0.1538 — 2026-08-26

This release carries everything since v1.0.1466, including the two pre-releases
v1.0.1480 and v1.0.1491.

:::caution
This release moves stored data from Hive to an encrypted SQLite database. The
move is one-way — a build older than your data will not open it, and at this
version a downgrade stops at launch with nothing on screen. Export a backup
before updating if you might need to go back. (v1.0.1617 added a screen that
explains the situation and lets you export or wipe.)
:::

### Added

- **BMC over Redfish.** Enterprise management hardware from about 2016 on
  usually speaks Redfish, and the server detail page can now show its power
  state and sensors — inlet and CPU temperatures, fan speeds, chassis draw —
  and act on power: power on, shut down, force off, restart, power cycle, each
  behind a confirmation naming the reset type. There is no *ignore
  certificate* option: trust is on first use, with the fingerprint shown for
  you to compare. Accounts are shared records, managed at **Settings → BMC
  accounts**, each showing how many servers use it. Marked Beta.
- **Several Linux systems at once on iOS.** **Settings → Terminal → Linux
  (Beta)** installs distributions side by side, each a row with its own mark
  and version; tapping one selects where a *new* terminal opens. Distributions
  and versions come from a signed manifest verified against a key compiled into
  the app.
- **Generate SSH key pairs in the app.** **Settings → Private Key** now offers
  *Generate key pair* or *Import*: Ed25519 (the default), ECDSA P-256, RSA
  2048 and RSA 4096. The generated page shows the public key with a copy
  button and the line to append to `authorized_keys`. Private keys are stored
  as they were given now, so an imported encrypted key stays encrypted and its
  passphrase is asked on first use rather than being stripped at import.
- **SCP file transfer**, for an old or embedded host whose SSH server has no
  SFTP subsystem. Chosen per server in the editor as a *File* row with an
  **SFTP**/**SCP** popup; it needs the `scp` command and the usual file
  utilities on the server. The browser says so when an SFTP session is what
  failed to open.
- **Floating terminal.** The picture-in-picture button in the terminal's action
  bar moves it into a window that floats over every tab — draggable and
  resizable on desktop, a pill that opens into a sheet on a phone. It is the
  same session, so the tab draws a placeholder rather than a second view, and
  a floating terminal is marked as such in the tab.
- **An Agent workspace across servers**, the *Agent* tab, with tools that read
  the app's own state: the server list, connection status, connect and
  disconnect, and keeping a temporary connection as a new server. A temporary
  host asks for its password in the app rather than in the conversation, and
  says plainly when that host and password will be saved on the device.
- **Distribution marks.** The app identifies the far end's distribution and
  can draw a small mark beside a server's name — off by default, at
  **Settings → Server → Distribution marks**. With no *Mark URL* configured it
  uses one of four bundled marks (Debian, Gentoo, Alpine, NixOS) and a generic
  icon for everything else. Turning it on shows a terms dialog first, since a
  mark says only what this device read from the remote system.
- **Combined key and password authentication**, and keyboard-interactive
  authentication for servers that offer it.

### Changed

- **Storage moved from Hive to one encrypted SQLite database.** The move runs
  at launch with no prompt and copies rather than deletes, so the old data is
  still on disk afterwards. A record that fails to convert is skipped, and the
  app carries on with that store empty.
- **Watch and home widgets read the agent's authenticated API.** A hand-typed
  `/status` address is not enough to reach an authenticated endpoint, and the
  login it would need is what those addresses existed to avoid, so they no
  longer work and cannot be converted — a one-time dialog says so, and
  configuring the server in the app once feeds every watch and widget. An
  agent is required. Watch servers moved from opt-in to opt-out: every server
  with an agent syncs by default, with exclusions at
  **Settings → App → iOS → Watch app**. The iOS home widget now needs iOS 17,
  and the watch app and complication need watchOS 10.
- **Android keeps SSH alive in the background** through a foreground service
  instead of dropping every connection within seconds of switching apps. If
  notification permission is off, a row under *Run in background* says an
  ongoing notification is required and opens system settings.
- Android Auto Backup no longer applies: the database is encrypted with a
  device-bound key that a cross-device restore would not carry. Recovery
  between devices is the app's own encrypted export.

### Fixed

- Servers without a home directory are handled.
- tmux rendering is correct for UTF-8, and its UI is localized.
- The Windows IME candidate window's text reaches the terminal.
- `systemctl` is used to list units, so units that `systemctl list-units`
  alone would miss are shown.
- Splitting an Android build no longer breaks reproducibility, and the probe
  for Impeller support runs before startup rather than after.

## v1.0.1466 — 2026-07-16

### Changed

- **Update checks read GitHub Releases** instead of a vendor manifest, with the
  App Store lookup used on iOS. The dialog now shows the notes of every version
  between the one installed and the one offered, not only the newest. A
  release published only to the CDN is no longer seen.
- The Docker host field is now *Edit CONTAINER_HOST* on a Podman server and
  *Edit DOCKER_HOST* on a Docker one, with separate storage keys, so one
  server's Docker and Podman hosts no longer overwrite each other.

### Fixed

- **Backups can be restored.** Serialization fell back to `toString()` for any
  object it could not encode, so servers, snippets, private keys, port
  forwards and Wake-on-LAN configs were written as `Instance of 'Spi'`-style
  strings — a backup that completed and could not be restored. Each model now
  has an explicit case, and anything unsupported fails loudly instead of
  degrading. Backups written by versions 1.0.1448–1.0.1450 are affected and
  cannot be fully restored.
- Container names or images containing spaces no longer shift the columns of
  the whole container list.
- Korean is complete for this release.

## v1.0.1450 — 2026-06-27

:::caution
Upgrading asks you to re-confirm the SSH host key of every server, once per
key type. The stored fingerprint was an MD5 digest and is now a SHA256 one;
the app reads the change as a mismatch and asks before continuing. This is
expected and not a sign of an attack.
:::

### Added

- **tmux in the terminal.** Auto-attach on connect, a session and window
  picker, and a default session name — all off by default under **Settings →
  Terminal → tmux auto-attach**. The terminal's virtual key strip gained a
  tmux key, and it says so when tmux is not installed on the server.
- **Auto-reconnect.** A dropped connection reconnects with a cancellable
  progress dialog and re-attaches tmux. A shell without tmux also reconnects,
  to a fresh shell, which means its state is lost.
- **Built-in terminal or system SSH, on every desktop platform.** The switch
  is at **Settings → Terminal → General**: built-in uses the app's own
  terminal, system SSH launches the system `ssh` command in an external
  terminal emulator. On macOS the external terminal is Terminal.app and is no
  longer configurable; that row is Linux-only now.

### Fixed

- SFTP downloads show throughput (`transferred / size – percent – speed`) and
  run faster: the chunk size went from 16 KB to 32 KB and in-flight requests
  from 1 to 64.
- The sudo password autofill recognises the prompt in more forms, including a
  fullwidth colon, and says when no prompt is active instead of doing nothing.
- The terminal no longer injects a locale the user did not configure; only the
  server's own environment variables are passed.

## v1.0.1426 — 2026-06-05

### Added

- **Per-process disk I/O rates** appear on the Process page as sortable *R/s*
  and *W/s* columns. They need a window at least 1100 px wide, a server that
  reports the counters, and two samples, so the first reading after opening the
  page is empty.

### Fixed

- SFTP downloads no longer stall, and the persistent SFTP channel is closed
  when the page is disposed.
- The sudo password prompt is detected in more cases in the virtual keyboard.

## v1.0.1409 — 2026-05-12

### Added

- **Pull an image** from the container page: an image row's menu offers *Pull*
  and *Delete*. A dangling image, which has no repository or tag, pulls
  nothing and says so.
- **Two jump servers, tried in order.** The server editor's SSH advanced
  section takes up to two jump servers, numbered in the order they are tried;
  the first that forwards wins. Timeouts, refused connections and forwarding
  failures advance to the next candidate, while authentication and permission
  errors stop rather than trying the other. A selection that would form a cycle
  is not offered, and jump servers and `ProxyCommand` cannot both be set.
- File tap opens the editor, and long-press keeps the action menu. Files over
  1 MB are refused by the editor.
- An AI API endpoint can be given as a full `.../chat/completions` URL or as a
  service base URL; `v1` and the path are appended as needed.

### Changed

- The terminal's *Theme* setting gained **Auto**, which follows the app's own
  theme rather than the system's.

### Fixed

- A temporary private key written for the desktop system-SSH path is now
  tightened on Windows as well, using `icacls`; if that fails the launch is
  aborted with an error rather than proceeding with a readable key.
- A status command that times out no longer wedges the shared shell for the
  rest of the connection — the app falls back to a one-shot channel.

---

### Src Content Docs Installation (`docs/src/content/docs/installation.mdx`)

---
title: Installation
description: Download and install Server Box
---

Server Box is available on several platforms. Choose the download source for your device.

## Mobile

### iOS

Download Server Box from the **[App Store](https://apps.apple.com/app/id1586449703)**.

### Android

Choose an installation source:

- **[GitHub Releases](https://github.com/lollipopkit/flutter_server_box/releases)**: Project release page
- **[F-Droid](https://f-droid.org/packages/tech.lolli.toolbox)**: FOSS app repository
- **[OpenAPK](https://www.openapk.net/serverbox/tech.lolli.toolbox/)**: Third-party app store

## Desktop

### macOS

Download from **[GitHub Releases](https://github.com/lollipopkit/flutter_server_box/releases)**, or install with Homebrew Cask:

```sh
brew install --cask server-box
```

macOS 13 or later is required. GitHub Releases provide `ServerBox-<version>-arm64.dmg` for Apple silicon and `ServerBox-<version>-amd64.dmg` for Intel; Homebrew automatically selects the correct build for your Mac.

The Mac App Store version is no longer updated. Install the DMG over it: its first launch copies the App Store version's data in.

### Linux

Download a package for `x86_64` from **[GitHub Releases](https://github.com/lollipopkit/flutter_server_box/releases)**, replacing `N` in the filenames below with the build number of the file you downloaded:

- **Debian / Ubuntu (`.deb`)**:

  ```sh
  sudo apt install ./ServerBox_v1.0.N_amd64.deb
  ```

- **Fedora / RHEL / openSUSE (`.rpm`)**:

  ```sh
  sudo dnf install ./ServerBox_v1.0.N_x86_64.rpm
  # or on openSUSE:
  sudo zypper install ./ServerBox_v1.0.N_x86_64.rpm
  ```

- **AppImage (`.AppImage`)**: Download `ServerBox_v1.0.N_amd64.AppImage` (or `_legacy_amd64.AppImage` for older glibc systems such as Ubuntu 22.04 / Debian 12), mark it executable, and run it.
- **Portable archive (`.tar.gz`)**: Extract `ServerBox_v1.0.N_linux_amd64.tar.gz` and run `ServerBox_v1.0.N_linux_amd64/bundle/ServerBox`.

The `.deb` and `.rpm` packages install to `/opt/serverbox`, link `/usr/bin/serverbox`, and register the desktop entry and icon. They are built against glibc 2.35 for compatibility across Ubuntu 22.04+, Debian 12+, Fedora, and openSUSE.

### Windows

Download the installer (`ServerBox_v1.0.N_windows_amd64.exe`) from **[GitHub Releases](https://github.com/lollipopkit/flutter_server_box/releases)**, or install with WinGet or Scoop:

```sh
winget install lollipopkit.serverbox
```

```sh
scoop bucket add extras
scoop install extras/serverbox
```

The installer installs for the current user into `%LOCALAPPDATA%\Programs\ServerBox`, without administrator rights, and adds a Start menu entry and an uninstaller. A new version installs over the old one; settings and servers are kept.

The installer is not code-signed, so SmartScreen may show "unknown publisher". A portable zip is also published alongside it (used by the official Scoop `extras` bucket).

## watchOS

The Watch app is distributed with the iOS app through the **[App Store](https://apps.apple.com/app/id1586449703)**. After installation, configure the servers to show in the iPhone app. The Watch app requires watchOS 10 or later; the iOS app itself still supports iOS 15 or later.

## Building from source

To build Server Box from source, see the [Building guide](/docs/development/building/).

## Version information

See the [Changelog](/docs/changelog/) for what changed in each version, and
[GitHub Releases](https://github.com/lollipopkit/flutter_server_box/releases)
for the installers themselves.

---

### Src Content Docs Introduction (`docs/src/content/docs/introduction.mdx`)

---
title: Introduction
description: Monitor and manage remote servers with Server Box
---

Server Box is a cross-platform app for monitoring and managing Linux, Unix, and Windows servers.

## What is Server Box?

There are two ways to connect to a server: **SSH**, or a **[Monitor](/docs/advanced/monitor-agent/)** running on the server. SSH requires no additional server software and provides terminal, SFTP, and port-forwarding features. The Monitor is useful when opening an SSH port is inconvenient. It also stores monitoring history continuously, so charts can include data collected before the App connects.

The same server can use SSH and Monitor at the same time. The App tries them in the configured order and can fall back to the other connection. Features from both connections remain available.

## Key features

- **Real-time monitoring**: View CPU, memory, disk usage, network speed, GPU status, and system temperature
- **SSH terminal**: Connect through SSH with multiple tabs and a customizable appearance
- **SFTP client**: Browse and manage server files
- **Container management**: Manage Docker and Podman containers
- **Process management**: View and manage system processes
- **Systemd services**: Start, stop, and monitor systemd services
- **Network tools**: Run iPerf, ping, and Wake-on-LAN (WoL)
- **Snippets**: Save and execute custom shell commands
- **[Agent](/docs/advanced/agent/)**: Ask a model to diagnose server issues and propose actions for you to review and approve

## Supported platforms

- **Mobile**: iOS and Android
- **Desktop**: macOS, Linux, and Windows
- **Companion app**: watchOS

## License

This project is licensed under AGPL v3. Source code is available on [GitHub](https://github.com/lollipopkit/flutter_server_box).

---

### Src Content Docs Privacy (`docs/src/content/docs/privacy.md`)

---
title: Privacy Policy
description: What Server Box stores, what it sends, and how to control those choices
---

Last updated: 2026-10-05.

Server Box is a client for the servers you configure. It has no user account and
no developer-operated relay for SSH, SFTP, or Monitor traffic. Connections to
those services go directly from the app to the endpoint you selected.

The app makes separate network requests for diagnostics and for features you
use. Their destinations and payloads are described below. Server Box contains no
ads, advertising identifiers, or cross-app tracking.

## Data stored on this device

| Data | Storage and behavior |
|---|---|
| Server names, addresses, ports, usernames and settings | Encrypted SQLite database |
| SSH passwords, private keys, Monitor and BMC credentials, saved sudo passwords, key passphrases, AI provider API keys, MCP headers, and the WebDAV settings with their password | Encrypted SQLite database; the database encryption key is kept in the platform keychain |
| Backup password and sync key | Platform secure storage |
| App logs | Local log files only; the current and previous run are retained for troubleshooting |
| Agent conversations, memory notes, AI providers and tool settings | Local encrypted database; conversations may contain prompts, model responses, command output, terminal text, file content and fetched pages |
| Active terminal output | Kept in the active session; the terminal does not retain it after the session ends |
| Downloaded city-level location data | Unencrypted files in the app's data directory, created only after you confirm the download; see [Globe and location data](#globe-and-location-data) |
| Public-interface-address results reported by servers, including an explicit no-address result | Encrypted app database, one entry per server. Once seven days old, a record can be refreshed by a later status poll. Coordinates are not stored; each one is derived again from the downloaded data whenever needed |

Agent conversations are excluded from backups and device sync. They remain on
this device until you delete them from the conversation history.
**Backup → Synced data** chooses what else sync carries, one switch per kind:
settings, AI (providers, tool settings, permissions and memory notes),
sudo passwords and API keys (with MCP headers and the WebDAV settings), key passphrases (only on a device that remembers them),
fonts, images and skills, and benchmarks. An Agent
conversation can still be sent to the AI provider you configured; see
[AI requests](#ai-requests).

Backups are created only when you request one. Depending on the options and the
backup format, a backup can contain server settings with their SSH passwords,
private keys, snippets, port forwards, remote desktop profiles with their saved
passwords, container settings, connection history, app settings and AI
settings, encrypted or not. Only an encrypted backup also holds saved sudo
passwords, API keys, MCP headers, the WebDAV settings, and key
passphrases. Agent conversations, sign-ins to AI providers and MCP
servers, and device-local state are not included. Fonts, images, skills and
benchmarks are synced through iCloud, WebDAV and LK Cloud, not in a backup
file.

A local backup may be unencrypted when no backup password is set. When you set a
backup password, an exported backup is encrypted before it is written or
uploaded, as an [age](https://age-encryption.org) file in passphrase mode:
`age -d` and the backup password open it without ServerBox.
Automatic sync requires a non-empty backup password. Synced data is encrypted
with a sync key, while the sync key itself is stored alongside it as
`identity.age` and is the only file encrypted directly with the backup password
(`age -d` with the backup password decrypts the key, and `age -d -i` with the
key decrypts the remaining files). If a device's backup password cannot unlock
that key, sync pauses on that device until you enter the password used by your
other devices. After data is uploaded to iCloud, WebDAV or LK Cloud, that
provider's storage, access and retention policies also apply.

## Automatic diagnostic data

Automatic diagnostics are the only telemetry sent to the developer's diagnostic
services. The choice is shown on the intro page before the first upload and can
be changed at any time in **Settings → Application → Privacy**.

| Level | What is sent automatically |
|---|---|
| **Nothing** | Nothing. Local logs remain on this device, and you can still prepare a manual report. |
| **Basic information** | Captured crashes and errors, with build and platform information and deliberately recorded diagnostic breadcrumbs attached when relevant. Nothing is sent continuously while the app is operating normally. |

The default on every platform is **Nothing**. No data is uploaded until you
choose **Basic information** on the intro page or in Settings. On builds where
automatic diagnostics is available, the intro page appears before the first
automatic upload.

Changing the level to **Nothing** stops automatic delivery immediately; it does
not wait for the next launch.

Earlier versions also offered **Full information**, which added performance
traces and feature-use analytics. It has been removed. An install that had
chosen it is moved to **Basic information** when it updates, and the
per-install analytics identifier that level stored on the device is deleted.
No performance traces or feature-use events are sent at any level.

### What automatic reports contain

Depending on the platform and the error, an automatic report can contain:

- The error type, message and stack trace
- The app build number, storage schema version and whether the build includes a
  local Linux userland
- Operating-system and kernel information, hardware model, CPU count, memory
  size and app memory use where the platform provides them
- Language, locale and time zone
- Dart and Flutter runtime versions
- Structured diagnostic breadcrumbs such as the transport used, the kind of
  terminal or file backend, and an operation's outcome where it was recorded
- A platform-provided native-crash, ANR or hang reason and trace, where one is
  available

Breadcrumbs use fixed action names and coarse or redacted values. They do not
include terminal output, file contents, passwords or private keys as diagnostic
fields. The app's ordinary log stream is never uploaded at any level.

An error message or stack trace comes from the underlying library and may contain
text that the app did not create. Server details therefore cannot be ruled out
for every possible exception. Automatic diagnostics should not be treated as a
guarantee that arbitrary exception text is anonymous.

The app does not install a native crash signal handler. Instead, when the
platform provides a native-crash, ANR or hang record, Server Box reads it on the
next launch. If automatic diagnostics is enabled, the record can then be sent as
an error report; otherwise it remains available locally and can appear in a
manual report.

## Redaction and manual crash reports

Structured diagnostic breadcrumbs are made safe when they are created, before
any reporting sink receives them. They use fixed action names and stand-ins for
server-related values rather than recording a server name, address or username
directly.

A manual report is different. After a crash, Server Box creates a report from
the previous run's retained log and any native-crash or hang details supplied by
the platform. It replaces configured server names, SSH hosts, SSH usernames and
Monitor addresses that it recognizes, but does not claim the complete report is
anonymous.

The newest report is kept under **Settings → Application → Privacy → Crash report**;
the row appears only while a report exists. You can review the complete text,
copy it, copy it and open a GitHub issue page, or delete it. Nothing is posted
automatically. This manual path is available at every diagnostic level,
including **Nothing**.

**The app log is never uploaded automatically, at any level.** Basic may send
the error and stack trace that ended a run, together with the build and
platform information described above, but they do not send log lines. If the
error happened before the reporting sink started, it may be sent as an error on
the next launch. The saved manual report remains on the device until you delete
it or a later crash replaces it.

Older log lines, temporary hosts and values the app does not know may still be
present in a manual report. The report is therefore not guaranteed to be
anonymous. Anything pasted into GitHub is public and is covered by
[GitHub's privacy statement](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement).

## AI requests

The Agent uses the providers you add at **Settings → Application → AI → Providers**:
built-in ones from the model catalog, and custom endpoints. No request is made
until you send an Agent message, and each goes to the provider of the chat's
model.

Depending on the operation, a request can contain your prompt, selected terminal
text, recent conversation history, the configured server name and context needed
for the Agent to work. After a command or file operation, its result can be sent
in a later request so the model can continue. Command output and file content may
contain passwords, tokens or other secrets even when Server Box did not add them
itself; check what you submit and review the provider's privacy policy.

A provider's API key is stored in the App's encrypted database and sent only
to that provider. A custom provider at a plain `http://` address on another machine is
refused unless you allow it for that provider, since the key would travel
unencrypted. The **Web fetch** tool requests a page from this device when the
Agent uses it, and MCP servers you add receive the calls made to their tools.
Installing or updating a skill from a remote source downloads it from the
source you enter (GitHub, GitLab or the site), over `https`; one from a folder
or a `.zip` on this device is read locally, with no request. Skills are kept
as files on this device and synced with the fonts and images.
An MCP server's headers and sign-in tokens are kept in the App's encrypted
database and sent only to that server, and only over `https` unless the server
is on this device. The headers are synced with the sudo passwords and API keys; a
sign-in stays on this device.
Server Box does not proxy AI requests through a developer service.

## Globe and location data

The globe draws each server at a coordinate. Server Box resolves geolocation
from data stored on this device; it does not send a server address to a
geolocation API or make a request to the dataset service for each lookup. A
configured hostname may still be resolved through the device's DNS service, as
it is when the app connects to that server.

A server is placed from the first of these that answers:

- A coordinate you typed in the server editor, under **More → Location**.
- A public address the machine reported for itself, when the app connects
  through a private address. It comes from the ordinary SSH or Monitor status
  poll, then is resolved with the downloaded city dataset. No separate command
  or external public-IP lookup is made.
- The SSH or Monitor connection address, resolved with the downloaded city
  dataset.

The city dataset is not included in the app and is never fetched automatically.
Tapping **Download** on the globe or in **Settings → Server → General →
Globe** first retrieves a small manifest so the confirmation dialog can show
the current download size, installed size, source URL and attribution. The data
files are fetched only if you confirm. The dataset is currently about 25 MB to
download and 52 MB after installation, but the manifest values shown by the app
are authoritative. The data is updated monthly; **Update** replaces the
installed files rather than retaining another copy. **Delete** removes the
dataset. Location data is provided by [DB-IP](https://db-ip.com) under CC BY
4.0.

The download service can observe a manifest or data-file request from your
network, including the network IP address and request time available to an HTTP
service. After installation, every geolocation lookup reads a local file. The
service receives no per-lookup request and cannot learn which server addresses
are queried, how many are queried or when they are queried.

Coordinates are not stored. Each one is derived again from the installed dataset
whenever it is needed, so what the globe shows always reflects the dataset
currently on the device and stops being available when that dataset is deleted.
The device-local record kept for this feature is the latest public-interface-
address result reported by a server, including the result that it reported no
public address. It is stored in the encrypted app database because only that
machine can supply it. The record is not included in backup or sync. Once it is
seven days old, a later ordinary status poll can refresh it.

Turning **Globe** off removes the button from the server tab and stops location
resolution. It does not delete the downloaded dataset or the stored
reported-address result. Use **Delete** on the dataset row to remove the data
files. There is no separate manual-clear action for reported-address records;
deleting a server removes its record.

Relevant redacted breadcrumbs may accompany an error at the Basic level, for
example that the view was opened and how many servers each source placed. No
coordinate, address, server name or country is included.

## Other network requests

These requests are made only for the corresponding feature and do not carry the
automatic diagnostic payload described above.

| Request | Destination | When and what it carries |
|---|---|---|
| AI request | The endpoint configured by you | When you send an Agent message; see [AI requests](#ai-requests) |
| Backup or sync | iCloud or your WebDAV server | When you upload, download or sync a backup; an uploaded backup file, which may be encrypted. Sync sends the backup and each device's changes, encrypted to a sync key, and that key, encrypted with the backup password |
| Update check | `api.github.com` | On launch when automatic update checks are enabled |
| Linux userland manifest | `github.com` | When the app checks for a newer local Linux release; it contains release metadata and signatures |
| Linux userland image | The distribution mirror or source URL selected by the verified manifest | When you install or update a local Linux environment; the image is checked against the manifest's digest |
| City-level location data | `ipgeo.lollipopkit.com`, with GitHub Releases as fallback | When you tap **Download** on the globe or in **Settings → Server → General → Globe**, or tap **Update** in settings. The manifest is requested first; data archives follow only after confirmation. Later geolocation lookups are local—see [Globe and location data](#globe-and-location-data). |
| Server logo or distribution mark | The URL configured by you | When a custom logo or mark URL is set; the image provider can receive the request |
| Sponsor link | `cdn.lollipopkit.com` | When you open the sponsor link |
| Documentation and issue links | `serverbox.lollipopkit.com` or `github.com` | When you open one of those links |

Connections to your own servers, to a BMC you configured and to a Monitor
you deployed go directly to those endpoints. They are not routed through the
developer's infrastructure.

## Where diagnostic data goes

Error reports go to the Sentry-compatible server operated by the developer at
`sentry.lollipopkit.com`. No analytics service receives data from the app.

The Sentry destination is written into the source, so a build made from
unmodified source reports to it too unless its builder changes it. Automatic
diagnostics are still off by default and require an explicit choice.

Diagnostic data is not used for advertising, shared with other companies, or
used to track you across apps or websites. The services may retain reports for as
long as they are useful for fixing the problems they describe. To request
removal of a report, open an issue at
[github.com/lollipopkit/flutter_server_box](https://github.com/lollipopkit/flutter_server_box/issues)
with the approximate time, app version and a short description of the problem.
Do not include passwords, keys or other sensitive content in a public issue.

## Watch app and home-screen widgets

The watch app, its complication, and the iOS and Android home-screen widgets
read a Monitor you deployed directly. They use a read-only credential that
Server Box mints for each surface. The credential can reach only the Monitor
metrics endpoints (`/api/v1/status`, `/api/v1/metrics` and
`/api/v1/metrics/history`); it cannot open a shell, execute commands or browse
files.

The credential is kept in the watch's own keychain, in a shared keychain group
on iOS, and encrypted under an AndroidKeyStore key on Android. A widget's
configuration list contains server names and Monitor addresses so you can pick a
server; its credential is kept separately in the platform credential store.
Servers are included automatically when they have a Monitor configuration. On
the watch, you can exclude individual servers in **Settings**; widgets publish
the Monitor-configured servers without a separate exclusion list. Excluding or
deleting a server revokes the watch or widget credential as soon as the app can
contact the Monitor.

## Platform stores

App Store and Google Play builds may also be subject to platform reporting.
Apple and Google collect that information under their own policies, not through
Server Box. See [Apple's privacy policy](https://www.apple.com/legal/privacy/)
and [Google's privacy policy](https://policies.google.com/privacy). The F-Droid
build has no store-provided crash-reporting channel.

## Children

Server Box is a server-administration tool and is not directed at children. It
does not knowingly collect information intended to identify children.

## Changes

If the collection arrangement changes materially, the diagnostics question is
shown again. A previous answer is not treated as consent to a materially
different arrangement.

## Contact

Open an issue at
[github.com/lollipopkit/flutter_server_box](https://github.com/lollipopkit/flutter_server_box/issues).

---

### Src Content Docs Quick Start (`docs/src/content/docs/quick-start.mdx`)

---
title: Quick Start
description: Add a server and view its monitoring data
---

Add a server, connect to it, and check its monitoring data.

## Step 1: Add a server

1. Open Server Box.
2. Tap **+** to add a server.
3. Select **SSH** as the connection method, then fill in:
   - **Name**: A name used to identify the server in the App
   - **Host**: An IP address or domain name
   - **Port**: The SSH port; `22` is the default
   - **User**: SSH username
   - **Password or Key**: Choose an authentication method
4. Tap **Save**.

### Connect through the Monitor

Use the Monitor instead when opening an SSH port is inconvenient:

1. Install and configure the [Monitor](/docs/advanced/monitor-agent/) on the server.
2. Enable **Monitor HTTP** on the Add Server page.
3. Enter the Monitor URL and its password. A self-signed certificate is shown on the first connection; compare its SHA-256 and trust it, or review it beforehand under **Monitor Certificate**.
4. Save the configuration.

SSH and Monitor HTTP can be enabled together. When both are configured, **Preferred transport** only controls which connection the App tries first; the other remains available. A server configured only through Monitor HTTP has no SSH credentials, and its command, terminal, and file features reach what the system account running the Monitor can reach.

## Step 2: Connect and view status

1. Tap the server card.
2. After connecting, view CPU, memory, swap, disk, and network status.

A server using the Monitor can show history collected before the App connected. An SSH-only server starts its local history when the App begins sampling.

## Step 3: Explore features

After connecting, you can:

- **Open the terminal**: SSH connections can open the terminal directly. Monitor HTTP connections open a shell as the account the Monitor runs as.
- **Browse files**: SSH connections use SFTP. Monitor HTTP connections use the Monitor's file API.
- **Manage containers**: View and control Docker or Podman containers.
- **View processes**: Inspect running processes.
- **Run snippets**: Execute saved commands.
- **Use Agent**: Diagnose or operate the server; see [Agent](/docs/advanced/agent/).

## Useful settings

- **Biometrics**: On mobile, enable Face ID, Touch ID, or fingerprint authentication to unlock the App quickly.
- **Home screen widgets**: After installing the Monitor, add the server to an iOS or Android widget.
- **Android background running**: To keep connections alive in the background, enable background running and allow notifications and background activity.

---

### Src Content Docs Advanced Agent (`docs/src/content/docs/advanced/agent.md`)

---
title: Agent
description: Configure providers, tools, and action approval for Agent
---

Agent connects a language model to your servers. The permission mode decides
which actions run without asking you (see [Review actions](#review-actions)).

Before the first message, add a provider at **Settings → Application → AI →
Providers**: pick one of the built-in providers (OpenAI, Anthropic, Google and
others from the model catalog) and enter its API key, or add a custom
OpenAI-compatible, Anthropic or Google endpoint. The same page chooses the
model a new chat uses. API keys are stored in the App's encrypted database and
are sent only to their own provider. A request is sent only
when you send a message.

## Choose an Agent

Server Box has two Agent entry points:

- **Agent tab** can work across configured servers. It can also open a
  temporary SSH connection to a host that is not in your server list, and read
  App state such as the list of servers and their connection status.
- **SSH Agent** is available from a terminal session. It works with the
  current server: it can read what the terminal shows and run commands on its
  connection. If you select terminal output and choose **Ask AI**, a new chat
  starts with that text in the message box, for you to add your question.

Each has its own chat list: a terminal's chats belong to that server. The
Agent floats above the other tabs while you work in the terminal or file
browser, so what it does elsewhere in the App stays in view; turn that off
with the float button in the Agent tab's header.

## Providers and models

**Settings → Application → AI → Providers** lists the built-in providers and your
custom ones. For a custom provider, enter its base URL including the API
version (for example `https://api.example.com/v1`) and pick its protocol:
OpenAI Chat Completions, OpenAI Responses, Anthropic Messages or Google
Generative AI. For an OpenAI-compatible endpoint the App lists the models it
offers; otherwise enter the model IDs.

A custom provider at a plain `http://` address on another machine is refused
unless you turn on **Allow plain HTTP** for it, because the API key would be
sent unencrypted. `http://localhost` and other addresses on this device do not
need it.

A built-in provider with no key entered uses one from the environment the App
was started with, under the variable that provider's tools use —
`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GEMINI_API_KEY` and so on — and the
provider list shows it under **System**, with the variable it came from. A key
entered in the App takes its place.

`OPENAI_BASE_URL` adds a provider of its own, **System**: an OpenAI-compatible
endpoint at that address, with `OPENAI_API_KEY` as its key and `OPENAI_MODEL`
as a model it may not list. `OPENAI_API_KEY` is then that endpoint's alone —
the built-in OpenAI provider does not send it to api.openai.com — unless the
address is OpenAI's own. Nothing of it is stored; it is whatever the App was
started with. A plain `http://` address on another machine is refused, as for
any provider. This is for a desktop App started from a shell: on macOS, an App
opened from Finder or the Dock does not see what your shell profile exports.

Settings from an earlier version — endpoint, model, protocol and key — were
moved to a custom provider when you updated.

## What Agent can do

The Agent tab's tools:

| Tool | Behavior |
|---|---|
| **Shell** | Runs a complete, non-interactive command on a server |
| **Read file** | Reads a text file from an SSH server over its configured SFTP or SCP transport; with local execution enabled, it can read a local file too |
| **Write file** | Replaces a text file over the configured transport; with local execution enabled, it can replace a local file too |
| **SSH connect** | Opens a temporary connection to a host not configured in the App |
| **Disconnect SSH** | Closes a temporary SSH connection |
| **Server Box** | Reads App state, including the server list and connection status |
| **Memory** | Keeps notes on this device that later chats can read |
| **Chat history** | Searches and reads your earlier Agent chats |
| **Web fetch** | Reads a web page, from this device |
| **Snippets** | Lists your snippets, and adds, changes or deletes them — changes ask first. It never sets a snippet to run by itself on a server |
| **Virtualization** | Reads the VMs and containers the Virtualization tab has loaded; a host not loaded yet is left alone |
| **Benchmark** | Reads benchmark results, and runs or stops a benchmark — asking every time. A run takes 10 to 20 minutes; when it ends, the chat that started it is told, and the Agent reads the result |
| **Remote desktop** | Lists remote desktop profiles, and connects (on the Remote desktop tab) or disconnects one, asking first. A profile without a saved password is connected from the App |

A terminal's chats have only two: **Shell**, which runs in that terminal's
connection, and **Read the screen**. Tools can be switched off by group at
**Settings → Application → AI → Tools**, where you can also add MCP servers, whose
tools the Agent tab then offers too.

Tap a server to edit it. One (Streamable HTTP) that wants a key takes it as
headers, a name and a value each, such as `Authorization` with
`Bearer <token>`. One that uses OAuth shows **Sign-in required**; **Log in**
opens the browser, and the App keeps the token and renews it. Headers sync with
the sudo passwords and API keys; a sign-in stays on this device. Both are sent only over
`https` unless the server is on this device.

## Skills

A skill is a set of instructions for a particular task — a `SKILL.md` and
any files beside it. Install one at **Settings → Application → AI → Skills** from the
same sources `npx skills add` takes: `owner/repo`, `owner/repo@skill`, a
GitHub or GitLab link (to a repository or a folder in it), a link to a
`SKILL.md` or an archive, or a site that publishes a `/.well-known` skills
index. A whole `npx skills add …` command can be pasted as it is. A folder
or a `.zip` on this device can be installed too, from the buttons below the
field or by entering its path. When a
source has several skills, you pick which to install.

The model sees each skill's name and description, and loads the rest when a
task matches it; loading one needs no approval. Skills are separate from
tools: turning tools off leaves them on, and each can be switched off on its
own. A terminal's chats get them too. The model follows what a skill says,
so install only from sources you trust; scripts in a skill do not run by
themselves. Once a day, at launch or when you open the Skills page, the App
asks each source whether its skills changed and marks the ones that did;
**Update all** installs them, and **Check for updates** asks right away.
Nothing is installed without you.

One skill comes with the App: **serverbox-help**, on how to use Server Box and
run the Monitor, so the Agent can answer questions about the App itself —
and set the Monitor up on a server, with your approval. It is updated with
the App and can be switched off, but not removed.

Agent's file tools require SSH. A server configured only with Monitor HTTP does
not provide these tools. Its separate **File** tab can use the Monitor's
file API.

## Review actions

The permission mode is **Manual**, **Auto** or **Allow all**, picked under the
message box or under **Settings → Application → AI → Command permissions**;
either one changes it for every chat. That page has the same rules and logic
as a Monitor's [Agent mode](/docs/advanced/monitor-agent-mode/), whose message
box changes that server's mode for new tasks the same way.

Every action goes through the command rules first: **Deny**, then **Ask**, then
**Allow**. Then:

- An action that loses something for good asks, except in **Allow all**.
- Anything else goes by the mode, a read-only action and an MCP tool included.
  **Manual** asks. **Auto** has the chat's model judge it against the auto mode
  rules: allowed runs, blocked is told to the Agent, no verdict asks. **Allow
  all** runs it; deny and ask rules still apply, and **Turn off Allow all**
  removes the mode.

When the App asks, it shows the command, its risk level and the model's
explanation. A denial is sent to the model so it can respond. In a terminal
chat, you can insert the proposed command, edit it and run it yourself. The
model's safety label is advisory; make your own assessment.

## When the Agent asks you

The Agent can ask for a choice or information it cannot retrieve itself. It
waits until you answer or cancel. It can ask up to four questions at a time,
with options and explanations; choose one or more options, or select **Other**
and enter your own answer. It can also request text input. A dot in the bar,
chat list, or floating pill marks a chat waiting for you; a spinner marks one
that is still working.
Sending a message instead cancels the form, and your message goes to the Agent
with it.

A password, key or token is asked for in a secret field. What you type there
never reaches the model or the chat history: the Agent gets a one-time handle,
which the App trades for the value when a tool needs it — connecting a remote
desktop whose profile keeps no password, for example.

## Connect to another host

Agent can open a temporary SSH connection to a host outside your server list.
If it needs a password, the App asks for it in a separate dialog; do not enter
the password in the conversation. Conversation text is saved on the device and
sent to the provider. Temporary connections are listed separately. To keep one,
save it as a server; its host information and password are then stored like
your other server credentials.

## Run commands on this device

**Run commands on this device** is a separate option at **Settings → Application → AI**
and is off by default. Once on, local commands go by the permission mode like
any other: **Allow all** runs them unasked.

The command target depends on the platform:

- **Desktop:** the computer running Server Box, including its files.
- **Android and iOS:** the Alpine Linux environment provided by the App. It
  cannot access the phone's own filesystem, App data, or user files. See
  [Terminal on This Device](/docs/advanced/local-terminal/).

The option is hidden on platforms that cannot run local commands, such as an
iOS build without the Linux engine.

## Conversation history

Chats are stored on the device, in the App's encrypted database, and long ones
are summarised as they grow. You can reopen, rename and delete them from the
history list. They are not included in backups or synced. Providers, tool
settings, permissions and memory notes sync under **AI** in **Backup → Synced
data**, the API keys under **Sudo passwords and API keys**. Messages and tool results can
contain command output, file contents and any terminal text you pasted; they
are sent to the provider when used in a chat.

## Before you send a message

- Models can produce incorrect advice or commands. Review every action before
  approving it.
- Command output, requested file contents, terminal text and fetched pages may
  be sent to the provider so the model can analyze them. Check for sensitive
  data before sending a message or approving a tool action.

---

### Src Content Docs Advanced App Mcp (`docs/src/content/docs/advanced/app-mcp.md`)

---
title: App MCP
description: Reach every server ServerBox knows from an MCP client, with the same tools and token model as the Monitor
---

The app serves the same MCP server as the [Monitor](/development/monitor-agent/#api-tokens-and-mcp), for every server it reaches: the tools, their answers, the token format and the scopes are shared. Each tool that is about a server takes a `host` argument, an id from `list`.

## Setup

Open **Settings → AI → MCP Server**. Choose **New token**, give it a name, pick its scopes, and save the displayed token: it is shown once. Turn on the switch and connect to `http://127.0.0.1:49762/mcp` with the token as a Bearer credential. Delete a token to revoke it; the next request is refused.

Select **Listen** to change the address and port. **All** listens on the wildcard address, **LAN** on one IP of a Wi-Fi, Ethernet or VPN interface such as Tailscale, and **This device** on loopback. LAN saves the selected IP, so select it again if your network assigns a different address. **Custom** accepts an address and port such as `[::]:49762`.

Loopback uses HTTP. LAN and wildcard listeners require TLS: put the PEM certificate chain and its private key beside the registry, appending `.crt` and `.key` to its filename (by default `app-mcp.json.crt` and `app-mcp.json.key`). On iOS, supply both in one passwordless PKCS#12 file ending in `.p12`. Restrict access to the private key, and connect to a name or IP in the certificate. Alternatively, keep the listener on loopback and reach it through an authenticated SSH tunnel.

For stdio clients, run `python3 /absolute/path/to/scripts/app-mcp-stdio.py` with the token in `SERVERBOX_MCP_TOKEN`. Set `SERVERBOX_MCP_HOST` and `SERVERBOX_MCP_PORT` if the destination differs from `127.0.0.1:49762`. The bridge verifies remote HTTPS certificates; for a private CA, set `SSL_CERT_FILE` to its PEM bundle. To reach a TLS listener on a loopback IP, set `SERVERBOX_MCP_SCHEME=https`.

## Tokens and scopes

A token is `sbt_` and 64 hex digits, stored as its BLAKE3 digest in the registry file (`app-mcp.json` in the app's documents folder; `SERVERBOX_MCP_POLICY` selects another one for desktop automation when no listener is saved). The registry is read again on every request, so it can be edited by hand:

```json
{
  "policy": {
    "scopes": ["read", "exec", "service"],
    "commands": { "mode": "allow_all", "deny": ["rm -rf *"] }
  },
  "tokens": [
    {
      "id": "<lowercase BLAKE3 digest of the token>",
      "name": "Desktop",
      "scopes": ["read"],
      "commands": { "mode": "allowlist", "allow": ["uptime", "df *"] },
      "created_at": 0
    }
  ]
}
```

A missing `scopes` grants every scope, including any a newer version adds. A token can do what both its own scopes and the policy's allow, and `run_command` must pass both command policies. Command rules use the Agent's pattern syntax, as on the Monitor.

| Scope | Tools |
| --- | --- |
| `read` | `list`, `machine_capabilities`, `processes`, `services`, `containers`, `tmux`, `app_settings` |
| `exec` | `run_command` |
| `process` | `kill_process` |
| `service` | `service_action` |
| `container` | `container_action` |
| `settings` | `app_setting_set` |

## Tools

`list` returns every server with its id, name, whether it is connected, and its transports (`ssh`, `monitor`, `local`). Ids are digests of the app's own server ids. **This device** is listed when **Settings → AI → Run commands on this device** is on.

A call reaches its server the way the app does: over SSH (reusing an open connection or connecting with the saved configuration, jump servers and `ProxyCommand` included), through the Monitor, or on this device. A host key to approve, a key passphrase or a keyboard-interactive question is answered by the person: the call fails, nothing is counted against the server's reconnect limit, and the next call works once the server is connected in the app.

`processes`, `services`, `containers`, `tmux`, `kill_process`, `service_action` and `container_action` take the Monitor's arguments and return its answers. `machine_capabilities` returns the server's platform and transports. When the app has not read the server yet, its platform is probed first.

`run_command` takes `host` and `command` and returns `exit_code`, `stdout`, `stderr`, `truncated` and `timed_out`. The command runs in the account's own shell. Output is kept up to 256 KiB. The app answers after 30 seconds at most, with `timed_out` set, and stops the command where the connection allows: a command reached through a Monitor may keep running until the Monitor's own timeout.

`app_settings` lists the app's editable preferences with their current values. `app_setting_set` takes `key` and a typed `value`, as the tool's input schema describes, and writes through the same store as the settings page. For example, set `editorFontSize` to `15.5`, `motionPref` to `"reduce"`, `trayMetrics` to `["cpu", "disk"]`, or `keybindings` to `{"settings.search": "Ctrl+Shift+F"}`. Arrays and maps replace the whole setting.

---

### Src Content Docs Advanced Bmc (`docs/src/content/docs/advanced/bmc.md`)

---
title: BMC (Redfish)
description: Configure and use out-of-band management when the host is unavailable
---

:::caution[Beta]
Only the read path (power state and sensors) has been verified against one real device. Power control has no automated verification yet. Compatibility with other vendors and models still needs to be established.

Treat power operations like pressing a physical power button on a remote server.
:::

A BMC (Baseboard Management Controller) is a small computer on the server's
motherboard. It has its own power and network connection, so it can remain
reachable when the host is off, unresponsive, or has no operating system. SSH
and Monitor depend on the host, so they cannot provide access in those
states.

Server Box connects to the BMC through **Redfish**, an HTTPS management API
used by enterprise servers. BMCs that expose only IPMI are not supported.

## What it provides

- **Power state:** Check whether the host is on or off, even if SSH and Monitor
  are unavailable.
- **Hardware sensors:** Read inlet and CPU temperatures, fan speeds, and
  chassis power draw reported by the BMC.
- **Power control:** Turn on the host, ask its operating system to shut down or
  restart, or directly power-cycle or force it off.

Use BMC alongside SSH; it does not replace normal host access. You can
configure SSH, Monitor, and BMC on the same server.

## Configure a BMC

1. Open the server's edit page and locate **BMC (Redfish)**.
2. Enter the BMC address, not the host's operating-system address. For
   example, use `https://10.0.0.9`; enter the scheme, host, and port only. The
   App adds the Redfish path.
3. Choose a saved BMC account or create one.
4. Open **Certificate** and compare its fingerprint with the value shown in
   the BMC's web interface. Accept it only after confirming the device.
5. Save the server.

The server detail page will show a BMC card with its reported state and
hardware-level power controls.

## BMC accounts

A BMC account is a separate record, so you do not need to enter the username and password repeatedly for each server. BMCs in one rack commonly share an account; changing it once updates every server that references it.

Manage accounts at **Settings → BMC accounts**. Each account shows how many servers use it, because editing the account affects all of them.

Deleting an account does not delete the servers that reference it. Those servers keep the BMC address but no longer have a usable account; the edit page indicates that state.

## Certificate verification

BMCs commonly use self-signed certificates. Server Box does not provide an “ignore certificate” option here: a BMC has power-control authority, and disabling verification would allow another service at that address to impersonate it.

The App uses a trust-on-first-use flow similar to SSH host-key verification:

1. The first connection shows the certificate fingerprint.
2. Compare it with the fingerprint shown by the BMC web interface and confirm it.
3. The App stores the accepted fingerprint and accepts only a matching certificate later.
4. If the fingerprint changes, the App refuses the connection, shows the old and new values, and asks you to verify the device again.

A BMC may legitimately change its fingerprint after regenerating a certificate or upgrading firmware. A man-in-the-middle attack produces the same symptom, so verify the BMC before accepting a new certificate.

Some BMCs ship with expired certificates. The App reports the expiry but still lets you accept the certificate after you have verified the device identity.

## Power operations

Power operations either ask the operating system to act or operate on the hardware directly:

| Operation | Through the OS | Effect |
|---|---|---|
| Shut down | Yes | Requests an OS shutdown; requires a running OS |
| Restart | Yes | Requests an OS restart |
| Power on | No | Powers on a host that is off |
| Force off | No | Cuts power; unsaved data is lost and filesystems are not cleanly unmounted |
| Power cycle | No | Turns power off, then on again |

**A graceful shutdown or restart is an accepted request, not proof of completion.** The App polls the BMC's reported power state instead of trusting a successful HTTP response. Some firmware accepts a request even when the operating system does not act on it.

If the power state does not change before the wait expires, the App reports *accepted*, not *confirmed*. *Accepted* means the BMC received the request; *confirmed* means the App observed the expected state change.

The supported `ResetType` values vary by BMC. The App reads the device's advertised operations and shows only operations that the device exposes.

## Current limitations

The following features are not implemented:

- Event logs
- Storage inventory
- Boot-device override
- Virtual media
- Relaying BMC access through the Monitor

If a BMC is on an isolated management network, the phone must be able to route to it directly. Monitor cannot currently proxy BMC access.

The App does not model physical-host and virtual-machine relationships. Several virtual machines may point to one physical host's BMC; a power operation from any of them affects the entire physical host and all its guests, and the reported power state belongs to the host. Configure BMC on the physical-host record only.

---

### Src Content Docs Advanced Bulk Import (`docs/src/content/docs/advanced/bulk-import.md`)

---
title: Bulk Import Servers
description: Import multiple server configurations from a JSON file
---

Use a JSON file to add several servers in one import. Each array item describes
one server, including its connection method and optional grouping or startup
settings.

## JSON format

:::danger[Security warning]
Import files are plain text and may contain credentials. Keep them out of
shared folders and source control, and remove them as soon as the import is
complete.

- Prefer an SSH key already stored in the App and reference it with
  `pubKeyId`; do not put private key material in this file.
- If a password or token must be included, restrict access to the file and
  delete it immediately after import.
- Add any import file to `.gitignore`. Never commit it, even if you think its
  credentials are temporary.
:::

```json
[
  {
    "name": "My Server",
    "ssh": {
      "ip": "example.com",
      "port": 22,
      "user": "root",
      "pubKeyId": ""
    },
    "tags": ["production"],
    "autoConnect": false
  }
]
```

SSH settings belong in the `ssh` object. This nested layout is used by the
App's exports and by the import dialog example.

Imports also accept older files with fields such as `ip`, `port`, and `user`
at the top level, including files imported from `~/.ssh/config`. New exports
use the nested layout above.

## Fields

| Field | Required | Description |
|---|---|---|
| `name` | Yes | Server name shown in the App |
| `ssh` | No | SSH configuration; omit for a server configured only through Monitor HTTP |
| `monitorHttp` | No | Monitor configuration: `addr`, `fallbackAddr` (the same Monitor at another address, tried when `addr` cannot be connected to), `user`, `pwd`, `certSha256`, `allowInsecure` |
| `preferredTransport` | No | Which transport leads when both SSH and Monitor HTTP are configured: `ssh` or `monitorHttp`. SSH leads when omitted |
| `tags` | No | Tags used to group servers |
| `autoConnect` | No | Connect automatically when the App starts |
| `custom` | No | Per-server extras such as `preferTempDev` and `logoUrl` |
| `pve` | No | Proxmox VE configuration; see below |
| `wolCfg` | No | Wake-on-LAN configuration |
| `envs` | No | Environment variables for the SSH terminal only |
| `customSystemType` | No | Skip automatic system-type detection |
| `disabledCmdTypes` | No | Status commands to skip on this server |
| `id` | No | Stable server ID; omitted or empty values are generated during import |

The following fields belong inside `ssh`:

| Field | Required | Description |
|---|---|---|
| `ip` | Yes | Domain name or IP address |
| `port` | Yes | SSH port, usually `22` |
| `user` | Yes | SSH username |
| `pwd` | No | Password; not recommended, use an SSH key instead |
| `fileTransport` | No | Which protocol carries files: `sftp` or `scp`. Defaults to `sftp`; use `scp` for a host with no SFTP subsystem |
| `pubKeyId` | No | ID of a private key stored in the App, not a PEM file path |
| `keyPath` | No | Desktop-only private-key path produced by a `~/.ssh/config` import; read from disk when connecting |
| `identityAgent` | No | The ssh-agent whose keys are offered, as `IdentityAgent` names one: `SSH_AUTH_SOCK` or a socket path; on Windows a named pipe, and `SSH_AUTH_SOCK` with the variable unset is `\\.\pipe\openssh-ssh-agent`. Omitted, no agent is used. Linux, Windows and macOS |
| `forwardAgent` | No | Forward `identityAgent` to the server's sessions, as `ForwardAgent yes`; whoever is root there can sign with its keys while connected. Defaults to `false` |
| `alterUrl` | No | Fallback address in the form `user@ip:port` |
| `jumpIds` | No | Jump-server chain specified by server ID |
| `controlPath` | No | Where an OpenSSH master connection to this server listens, as `ControlPath` names it. A server using this one as a jump is reached through that master when it is running. Linux and macOS |
| `proxyCommand` | No | ProxyCommand; on a phone it runs in the built-in Linux environment. Mutually exclusive with `jumpIds` |

The following fields belong inside `pve`:

| Field | Required | Description |
|---|---|---|
| `addr` | Yes | PVE web address, for example `https://127.0.0.1:8006`; the host is resolved on the server's side of the connection |
| `auth` | No | `token` or `password`. Defaults to `password` |
| `tokenId` | For `token` | API token ID in the form `user@realm!tokenid` |
| `tokenSecret` | For `token` | The token's secret; a credential, so treat the file as one |
| `pwd` | No | For `password`: the PVE password of the SSH user in the `pam` realm. Omit it to reuse the SSH password |
| `certSha256` | No | SHA-256 of the certificate to trust, lowercase hex. Omit it to confirm the certificate on the first connection |

Older exports put `pveAddr`, `pveIgnoreCert`, and `pvePwd` inside `custom`;
imports ignore them. Move them into a `pve` object to keep PVE.

A server needs at least one connection method. If both `ssh` and
`monitorHttp` are omitted, the imported record cannot connect to a host.

`allowInsecure` defaults to `false`. Set it only if you intend this Monitor
connection to use plaintext HTTP, including when the address is a private
non-loopback IP. The Monitor separately enforces its own
`allow_insecure` setting for sensitive endpoints.

## Import steps

1. Create a JSON array containing the server records.
2. Open **Settings → Backup → Import → Server**.
3. Select the JSON file.
4. Check the displayed server count and confirm the import.
5. Remove the import file and any copies as soon as the import finishes.

## Example

```json
[
  {
    "name": "Production",
    "ssh": {
      "ip": "prod.example.com",
      "port": 22,
      "user": "admin",
      "pubKeyId": "my-key"
    },
    "tags": ["production", "web"]
  },
  {
    "name": "Development",
    "ssh": {
      "ip": "dev.example.com",
      "port": 2222,
      "user": "dev",
      "pubKeyId": "dev-key"
    },
    "tags": ["development"]
  },
  {
    "name": "Behind NAT",
    "monitorHttp": {
      "addr": "https://10.0.0.5:3770",
      "user": "admin"
    },
    "tags": ["monitor"]
  }
]
```

After importing, test each connection and confirm that the expected tags and
transport settings appear on the server records.

---

### Src Content Docs Advanced Custom Commands (`docs/src/content/docs/advanced/custom-commands.md`)

---
title: Custom Commands
description: Show custom command output on the server detail page
---

Custom commands let you add server-specific checks to the server detail page.
Their output is collected whenever the App refreshes that server's status.

## Storage location

The commands live on each server, in
`~/.config/server_box/custom_cmds`. The App does not keep a local copy: the
editor loads the files from the server and writes changes back when you save.

You must be connected to the server to save edits. If it is unreachable, you
can open the editor but not save. The App and Monitor use the same files,
so edits in either one are immediately visible in the other.

## Editing

1. Open the server's edit page and select **Custom commands → Edit**.
2. Add a command, change its name or shell text, or drag it to a new position.
3. Save the changes to the server.

Each entry contains a display name and a shell command. The App uses the name
as the output label on the server detail page.

The saved order is also the order used on the server detail page. Reorder
commands in the editor to change how they appear.

## Special name

### `server_card_top_right`

The command named `server_card_top_right` is a special case. Its output is
shown in the top-right corner of the server card on the home page rather than
in the regular custom-command list.

## Writing commands

**Use absolute paths:**

```sh
/usr/local/bin/my-script.sh
```

**Pipes are supported:**

```sh
ps aux | sort -rk 3 | head -5
```

**Format output:**

```sh
uptime | awk -F'load average:' '{print $2}'
```

**Keep execution time short.** Aim for less than one second because the
command runs on every status refresh.

**Limit output:**

```sh
tail -20 /var/log/syslog
```

## Security

Commands run with the account used for the connection: the SSH user for SSH
connections, or the Monitor process user for Monitor connections.

For Monitor connections, the request must use secure transport or explicitly permit
`allow_insecure`. Each file in this directory is executable code: it runs as
the Monitor user on every status refresh.

Use read-only commands where possible. A command can affect the server with
the permissions of its execution account. Never include passwords, tokens, or
other credentials in a command.

## Legacy command storage

Older releases stored commands in server settings; the App preserves those
entries until the first connection, then moves them to
`~/.config/server_box/custom_cmds`. Current releases read and write commands
only in that directory.

---

### Src Content Docs Advanced Custom Logo (`docs/src/content/docs/advanced/custom-logo.md`)

---
title: Custom Server Logo
description: Set the large image shown at the top of a server's detail page
---

Set a custom image for the top of a server's detail page. This is separate
from **Mark URL**, which sets the small mark shown beside a server's name in
lists.

## Per-server setting

1. Open the server's edit page and expand **Optional → Appearance & location**.
2. Enter the image URL in **Logo URL** and save the server.

The per-server Logo URL takes precedence over the global setting. Both URLs
support the formatting placeholders below.

## Global default

Open **Settings → Server → General → Distribution mark → Logo URL** to set the
default image URL for servers without their own Logo URL.

## URL placeholders

### `{DIST}`: Linux distribution

`{DIST}` is replaced with the Linux distribution name detected by the App:

```text
https://example.com/{DIST}.png
```

For example, the resulting URL may end in `debian.png`, `ubuntu.png`, or
`arch.png`. If the App cannot detect the distribution, it does not use the
Logo URL.

### `{BRIGHT}`: Theme

`{BRIGHT}` is replaced according to the current theme:

```text
https://example.com/{BRIGHT}.png
```

The selected Logo URL resolves to `light.png` in a light theme and `dark.png`
in a dark theme.

### Combining both

```text
https://example.com/{DIST}-{BRIGHT}.png
```

For example, the App may request `debian-light.png` or `ubuntu-dark.png`,
depending on the detected distribution and current theme.

## Recommendations

- Use a PNG or SVG image between 64×64 and 128×128 pixels.
- Prefer an HTTPS URL.
- Keep the image small so loading it does not slow down the server card.

## Supported distributions

debian, ubuntu, centos, fedora, opensuse, kali, alpine, arch, rocky, deepin, armbian, wrt, coreelec

See [`dist.dart`](https://github.com/lollipopkit/flutter_server_box/blob/main/lib/data/model/server/dist.dart) for the complete list.

---

### Src Content Docs Advanced Globe (`docs/src/content/docs/advanced/globe.md`)

---
title: Globe View
description: View servers by location and manage the on-device location data
---

The server tab offers two layouts: the server grid and an interactive globe.
Select the globe icon above the server list to switch to it. Server Box opens
the view you used most recently the next time you visit.

Globe view is enabled by default. Turn off **Settings → Server → General →
Globe** to hide its button and stop location lookups. This keeps the downloaded
city dataset on the device. To delete the files as well, select **Delete** on
the **City-level data** row.

## How a server gets a location

Server Box checks these sources in order and uses the first available location:

| Priority | Source | Requirement |
|---|---|---|
| 1 | Coordinates you entered | Set in the server editor under **More → Location** |
| 2 | A public address reported by the server | Used when Server Box connects through a private address; the downloaded city dataset is still required |
| 3 | The address used for the connection | The downloaded city dataset is required |

Location lookups use the dataset stored on this device; Server Box does not
send server addresses to a geolocation API. A configured hostname may still be
resolved through your device's DNS service, as it is when connecting to the
server.

### Servers reached through a private network

A VPS accessed through a VPN or internal hostname may still have a public IP
on one of its network interfaces. The regular status poll already collects
interface addresses over SSH or through a
[Monitor](/docs/advanced/monitor-agent/). Server Box selects a public
address and looks it up in the local city dataset; it does not run an additional
command or contact an external "what is my IP" service.

A home server behind NAT usually reports only private addresses. In that case,
only a manually entered location can place it on the globe.

## Download city-level data

Server Box does not bundle the city dataset or download it automatically. You
choose when to install it:

1. Open the globe and tap **Download** beside the unplaced servers. You can
   also open **Settings → Server → General → Globe** and tap **Download**
   on the **City-level data** row.
2. Server Box fetches a small manifest so it can show the current download
   size, installed size, source URL, and attribution.
3. Review the confirmation dialog. The data files are downloaded only after you
   accept.

The dataset currently downloads about 25 MB and uses about 52 MB when
installed. These are estimates; the confirmation dialog reads the latest sizes
from the manifest and shows the values to use if they change.

- IPv4 and IPv6 data are both city-level.
- The dataset is updated monthly. When data is already installed, tap
  **Update** in settings to check for a newer version.
- Installing a newer version replaces the existing files; it does not keep an
  additional copy.
- Tap **Delete** to remove the dataset from the device.

The download host can see requests for the manifest and dataset files. Once
the files are installed, lookups happen locally and do not generate requests to
that host, so it cannot see which server addresses you look up or when. See the
[privacy policy](/docs/privacy/#globe-and-location-data) for the complete data
flow.

Without the city dataset, only servers with manually entered coordinates can be
placed.

## Servers without a coordinate

Servers without a usable coordinate appear as chips along the bottom of the
globe. Select a chip to edit that server's location.

- **Private address** — Server Box connects through a LAN, loopback, or
  link-local address, or through a hostname that resolves to one. Public
  geolocation datasets cannot locate these addresses.
- **No location data** — The hostname could not be resolved, the installed
  dataset has no matching record, or the city dataset has not been installed.

When every unplaced server has the same reason, that reason is also shown above
the row of chips.

## Enter a location manually

In the server editor, open **More** and fill in **Location (lat, lon)**. Enter
latitude first and longitude second, in degrees. For example:
`39.9042, 116.4074`. Separate the values with a comma or whitespace.

Latitude must be between -90 and 90, and longitude between -180 and 180. Server
Box rejects an invalid value when you save instead of silently discarding it.
A manual location has the highest priority and is not replaced by an automatic
lookup.

## Use the globe

- Drag to rotate it. A quick flick continues with momentum.
- Pinch to zoom. On desktop, use a mouse wheel or trackpad gesture.
- The globe rotates slowly while a located server is hidden on the far side.
  The first touch stops automatic rotation for the rest of that view.
- A server card shows its name and CPU and memory usage after readings arrive;
  while connecting, it shows the connection state.
- Marker colors indicate status: green when readings are available, orange
  while connecting, red after a failed connection, and gray when disconnected.
- Tap a card or marker to open the server.
- When more than 14 located servers are displayed, the globe shows markers
  without permanent cards. Tap a marker once to label it and again to open it.

The globe initially faces the first server in the current list that has a
coordinate.

## When a location looks wrong

Server Box does not cache lookup results. Each lookup uses the dataset
currently installed on the device, so updating the monthly dataset changes
the displayed location immediately.

For a server reached through a private address, Server Box may remember the
public interface address that the server reported for itself. Once that record
is seven days old, a later ordinary status poll can refresh it. To correct a
location immediately, set the coordinate in the server editor under **More →
Location**; a manual coordinate overrides every automatic source.

---

### Src Content Docs Advanced Host Keys (`docs/src/content/docs/advanced/host-keys.md`)

---
title: Host Keys and Certificates
description: How Server Box verifies a server, and how to trust a host certificate authority
---

Server Box verifies every SSH server before it sends a password or key.

## First connection

The first time you connect to a server, Server Box shows the host key type and
its fingerprint (`SHA256:...`) and asks whether to trust it. Compare the
fingerprint with the one the server reports:

```bash
ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub
```

After you accept, Server Box remembers the key for that server. If the server
later presents a different key, Server Box warns you before it connects.

## Host certificates

A server can present an OpenSSH host certificate
(`ssh-ed25519-cert-v01@openssh.com` and similar) instead of a plain host key.
Server Box supports Ed25519, ECDSA and RSA certificates.

Without a trusted certificate authority, Server Box handles a certificate as
OpenSSH does: it uses the key inside the certificate and asks about it on the
first connection, as described above. The fingerprint is the one of that key,
which matches the `Server host certificate: ... SHA256:...` line of `ssh -v`.

## Trusted certificate authorities

If your servers' host keys are signed by a certificate authority (CA), you can
trust that CA once instead of confirming each server. This is the equivalent of
an `@cert-authority` line in OpenSSH's `known_hosts`.

Open **Settings → SSH → General → Host certificate authorities** and select
**Add**:

- **Key**: the CA's public key line, for example the contents of `ca.pub`:
  `ssh-ed25519 AAAA... ca@example.com`. Ed25519, ECDSA and RSA keys are
  supported. You can also paste a whole `known_hosts` line,
  `@cert-authority *.example.com ssh-ed25519 AAAA...`; the hosts are then taken
  from it.
- **Host**: which servers the CA vouches for. The default `*` matches every
  server. It cannot be empty.

A server connects without a prompt when its certificate is signed by a matching
CA and is valid: a host certificate, within its validity period, without
critical options, not signed with SHA-1 (`ssh-rsa`), and listing the server
among its principals. Principals are compared with the address Server Box
connected to and with the address configured for the server; a certificate
without principals is valid for any host, and a principal may contain `*` and
`?`.

Otherwise, the server is asked about on the first connection as described
above, using the key inside its certificate. This includes a certificate that
a matching CA signed but that is expired or names another host, which is what
OpenSSH does too.

### Host patterns

The **Host** field uses the `known_hosts` pattern syntax:

| Pattern | Matches |
|---|---|
| `*` | Every server |
| `*.example.com` | `web.example.com`, `db.example.com` |
| `web-?.example.com` | `web-1.example.com`, not `web-10.example.com` |
| `10.0.0.*` | Addresses from `10.0.0.0` to `10.0.0.255` |
| `*.example.com,!bastion.example.com` | Every `example.com` host except `bastion` |

Separate several patterns with commas. A pattern that starts with `!` excludes
the hosts it matches. Matching ignores case.

A server on a port other than 22 is matched as `[host]:port`, as in OpenSSH.
For example, `[*.example.com]:2222` matches `web.example.com` on port 2222,
and `*.example.com` does not.

---

### Src Content Docs Advanced Json Settings (`docs/src/content/docs/advanced/json-settings.md`)

---
title: Hidden Settings (JSON)
description: Access advanced settings through the JSON editor
---

Use the JSON editor to change advanced settings without a dedicated control in
the interface. Change a value only when you understand what it affects.

## Open the JSON editor

In a debug or profile build, open **Settings → Application → General**, and in
the **System** group select **(Dev) Edit raw json**. Release builds do not
include this editor.

## Common settings

### `timeOut`

Maximum time to wait for a connection, in seconds.

```json
{"timeOut": 10}
```

**Type:** integer　**Default:** `5`

Use a positive timeout that suits your network.

### `recordHistory`

Whether the App saves recent items such as SFTP paths.

```json
{"recordHistory": true}
```

**Type:** boolean　**Default:** `true`

### `textFactor`

Scale factor for text in the interface.

```json
{"textFactor": 1.2}
```

**Type:** number　**Default:** `1.0`

Extreme values can make parts of the interface unusable.

## Find other settings

The setting keys and their defaults are declared in
[`setting.dart`](https://github.com/lollipopkit/flutter_server_box/blob/main/lib/data/store/setting.dart).

Search for declarations in this form:

```dart
late final settingName = propertyDefault('settingKey', defaultValue);
```

Use the key and default from the source for your App version. Settings can
change between releases, so confirm that a key still exists before editing it.

## Before editing

- **Back up your data first.** A malformed or unsupported value can stop the
  App from starting.
- **Keep the document valid JSON.** Check quotation marks, commas, brackets,
  and the expected value type.
- **Edit one key at a time.** Reopen the App and check the affected feature
  before changing another value.
- **Keep credentials out of this editor.** Do not enter passwords, tokens, or
  private keys in the settings JSON.

## Recovery

If an edit prevents the App from starting, try these recovery options in
order:

1. Restore the backup created before the change if possible.
2. Android: clear Server Box app data in system settings.
3. iOS: delete and reinstall the App.
4. Open the App and restore the backup.

Clearing app data or reinstalling removes anything that has not been backed
up. Use those options only if you cannot restore the App another way.

---

### Src Content Docs Advanced Local Terminal (`docs/src/content/docs/advanced/local-terminal.md`)

---
title: Terminal on This Device
description: Open a shell on the device running Server Box
---

When supported by the current build, the terminal tab shows local execution
options before your remote servers: a shell on **this device** and a Linux
userland provided by Server Box.

These entries need no server connection or credentials.

## Shell on this device

This shell runs on the computer or device that runs Server Box. Where shell
selection is supported, the App starts the shell named by `$SHELL`, which is
usually the one your terminal app opens.

| Platform | Availability |
|---|---|
| Linux, Windows | Available |
| macOS | Available |
| Android | Available, with different shell capabilities from desktop |
| iOS | Not available |

**iOS has no local shell.** App Store apps cannot start processes, and the
sandbox does not contain a `/bin/sh` executable.

## Linux userland

If the platform has no shell or its shell is limited, Server Box can install
an independent Linux userland. Alpine 3.22.5 is currently the default; the
release list may also include other distributions and versions, such as Debian
or Ubuntu.

The terminal tab labels it **<distribution> <version>** and lists it beside
the local shell. Choose the distribution and version when installing. Updating
keeps the existing profile and does not offer a different choice.

Android and iOS use different implementations:

- **Android:** Unpacks a Linux rootfs and enters it with `proot`. Current
  builds support arm64. The App downloads the rootfs as a tarball and checks
  it against a pinned digest.
- **iOS:** The App cannot start processes directly, so it includes a Linux
  interpreter. The userland is the filesystem that interpreter runs against.

**These features depend on the build configuration.** A build may provide only the local shell, only the Alpine userland, both, or neither. If the entry is missing from the terminal tab, the current build does not include that capability.

### Use cases

- Use `curl`, `dig`, `ssh`, or `jq` on a phone that does not include them.
- Perform temporary work that you do not want to run directly on a production server.
- Give Agent an execution target isolated from the device filesystem; see [Agent](/docs/advanced/agent/).

Each userland follows its distribution's standard layout and package manager.
For example, install packages with `apk add` on Alpine or `apt install` on
Debian and Ubuntu.

### Filesystem isolation

The Alpine userland has a separate filesystem and cannot read phone storage,
App data, private keys, or user files. **Run commands on this device** therefore
uses the isolated userland on mobile and the computer's own shell on desktop.

## Differences from a server terminal

The local terminal uses the same terminal emulator, virtual keyboard, and tabs
as a server session. Only the source of terminal input and output changes.

Because it runs locally, this shell has no server host key to verify and does
not reconnect as a server session would. It is not added to the server list
and has no status charts.

---

### Src Content Docs Advanced Monitor Agent Mode (`docs/src/content/docs/advanced/monitor-agent-mode.md`)

---
title: Monitor Agent Mode
description: Run an AI agent on a server from the Monitor panel, with permission modes, MCP servers, and skills
---

Agent mode is an AI agent in the Monitor panel. It runs commands on the machine
where the Monitor runs, as the system account the Monitor runs as.

Agent mode is a feature of the panel. The mobile app's
[Agent](/docs/advanced/agent/) is a separate feature with its own settings.
To install the Monitor, see [Monitor](/docs/advanced/monitor-agent/).

## Settings

Open **Settings → Agent** in the panel to change the model, providers, MCP
servers, skills, and memory.

### Model and providers

Agent mode needs a model before it can run a task. Under **Providers**, select
a built-in provider and enter its **API key**. To use another endpoint, select
**Add a provider**. Set its **Name**, **Base URL**, and **API**. The API is one
of OpenAI Chat Completions, OpenAI Responses, Anthropic Messages, or Google
Generative AI.

The panel lists the models that an endpoint offers. If an endpoint does not
list its models, enter their IDs under **More model IDs**.

API keys are write-only. The panel shows only whether a key is set. To replace
a key, enter a new one. To keep the current key, leave the field empty. To
remove it, select **Remove the key**.

Under **Model**, choose the default model for new tasks. Select **None (Agent
mode off)** to stop Agent mode from running tasks.

A base URL that uses plain `http://` is accepted only for a loopback address,
such as `127.0.0.1`. For another address, turn on **Allow plain HTTP** for that
provider. The key and every prompt then travel unencrypted. Redirects are not
followed.

### Task defaults

- **Tasks at once** sets how many tasks run at the same time, from 1 to 8.
  Other tasks wait in the queue.
- **Thinking** sets the default thinking level: Off, Low, Medium, or High.
- **Copy tasks for pi** is off by default. See [Copy for pi](#copy-for-pi).

## Tasks

Open **Agent mode** in the desk. Describe what to do in the composer and send
it. The agent then runs commands on the server to complete the task.

Before a change, the agent lays out a plan. Select **Run** to approve the plan.
Select **Change the plan** to tell the agent what to change first.

### Attachments

Use **Add attachment**, drag files into the composer, or paste them. A task
accepts up to 10 files, 20 MB each. The agent receives the name, type, size,
and path of each file. Text files up to 16 KiB are included in the prompt.
Images up to 5 MB are sent to the model as images. An attachment that is not
sent with a task is removed after one hour.

### Model and thinking level

Each task has its own **Model** and **Thinking** level. Choose them in the
composer. The list shows the models of custom endpoints and of built-in
providers with a key set. If you change them while a task runs, the change
applies from the next request to the model.

### Permission mode

The mode new tasks start in is picked in the composer, or switched with
Shift+Tab; it is the same setting as **Default mode** under the command
permissions, so the App's composer changes it too. A task keeps the mode it
started in. See [Permission modes](#permission-modes).

### Queue

At most **Tasks at once** tasks run together. A task that starts while the
limit is reached shows **Queued**. It starts when a task ahead of it ends.

### Reply

When a task finishes, type a reply in the reply box to continue it. The reply
runs in the same session, so the agent keeps the earlier context. You can also
add to a task while it runs.

### Stop and delete

Select **Stop** to end a running task. The command it is running stops with
the rest of its process group. Select **Delete** to remove a task. Deleting a
task also deletes its copy for pi, if one exists.

### Command time limit

Each command has a time limit, which the model sets for that command. The
limit is from 1 to 120 minutes. The default is 10 minutes. When a command
reaches its limit, the command and the processes it started are stopped.

### Output

Output appears as the command runs. A long output keeps its first 2000 and last
8000 lines. The model reads the last 12 000 characters of a command's output.

### Offline panel

If the panel loses its connection, tasks keep running on the server. The output
resumes when the panel reconnects.

## Permission modes

Each task runs in one of three permission modes. The mode decides what runs
without a question, after the command rules apply.

| Mode | Behaviour |
| --- | --- |
| Manual | Commands follow the command rules. A command that no rule matches waits for your confirmation. |
| Auto | The model judges each such command against the auto mode rules. An allowed command runs. A refused command stops, and the agent receives the reason. With no verdict, you are asked. |
| Allow all | Every command runs without a question, including deleting, restarting, and config changes. Deny and ask rules still apply. |

A read-only command follows the mode as any other does.

The default mode for new tasks is set under **Settings → Agent → Command
permissions → Default mode**.

You can select **Turn off Allow all** on that page. After that, no task
runs in Allow all. A task that was started in Allow all then runs as Manual.

## Command rules

Set the rules under **Settings → Agent → Command permissions**. There
are three lists: **Deny**, **Ask**, and **Allow**. Write one pattern per line.

- `*` matches any text. For example, `systemctl status *` matches every
  `systemctl status` command.
- A trailing `:*` has the same meaning as ` *`.
- A chained command, such as `a && b`, is checked part by part. Deny and ask
  apply when any part matches. Allow applies only when every part is covered.
- Deny and ask rules also see a command with `env`, `timeout` and the like taken off, and a program named by its path by its name: `/bin/rm` matches `rm *` there. Otherwise rules match the command as written: `sh -c 'rm …'` does not match `rm *`.
- Rules are not a security boundary.

The rules are checked in this order: deny, then ask, then allow.

Outside Allow all, a command that cannot be undone, such as deleting data or
partitions, asks you to type the server's name before it runs. This applies
even when a rule allows the command.

### Always allow

When a command asks for confirmation, **Always allow** adds a rule for that
command to the server's allow rules. The rule then applies to every task.
The panel shows the rule before you
choose **Always allow**. A command that matches an ask rule gets no suggested
rule.

### Auto mode rules

The auto mode rules are on the same page, under **Auto mode rules**. They are
written in plain language for the model. The sections are **Environment**,
**Allow**, **Soft deny**, and **Hard deny**.

An empty section uses the built-in rules. Write `$defaults` on a line to keep
the built-in rules and add your own below it. The model applies the rules in
this order: hard deny, then soft deny, then allow. An allow rule, or a request
from you that is explicit, clears a soft deny.

### Sudo

When a command uses `sudo`, the panel asks for the password of the account that
runs the command. The password goes to `sudo` only.

The panel asks again for each command. If you select **Don't ask again for 15
minutes**, the password stays in memory for 15 minutes. It is never written to
disk. It is removed when the account's sessions end, for example after a
password change.

On Windows, commands run in Windows PowerShell. `sudo` is not available there.

## Memory

Open **Settings → Agent → Memory** to see the files the agent keeps across your
tasks. The agent reads the files and updates
them as needed. `MEMORY.md` is the index. The agent reads it at the start of
every task.

You can create, edit, and delete files in this page.

## Deployed apps

The agent knows which web apps the Monitor has deployed on the server. For each
app, the system prompt of every task gives the state, the health, the loopback
address, the exact `compose` command, and the data folders. You can ask the
agent about an app by name. For how to deploy apps, see
[Monitor Apps](/docs/advanced/monitor-apps/).

## MCP servers

Add MCP servers under **Settings → Agent → MCP servers**. The agent gets
the tools of each enabled server in every task.

Only the Streamable HTTP transport is supported. The address must use `https://`,
or `http://` with a loopback address such as `127.0.0.1`.

To add a server, enter a **Name** and an **Address**. Add each header that the
server requires under **Header** and **Value**, such as `Authorization`. The
panel shows the names of the headers that it sends. A value is write-only. To
change it, select **New Authorization value** (named after the header) and enter the new value. The panel
never shows a saved value again.

The status of a server shows **Not connected** when the panel cannot reach it.

A tool follows the task's permission mode, as a command does, one marked as
read-only included. In Manual, it waits for
your confirmation. In Auto, the model judges it. In Allow all, it runs and is
recorded in the audit log.

### Example: Home Assistant

1. In Home Assistant, add the **MCP Server** integration.
2. Create a long-lived access token in your Home Assistant user profile.
3. In **Settings → Agent → MCP servers**, add a server with these values:
   - **Name**: a name of your choice
   - **Address**: `http://127.0.0.1:8123/api/mcp`
   - **Header**: `Authorization`
   - **Value**: `Bearer <token>`, where `<token>` is the access token from
     step 2

The address uses loopback, so the Monitor must run on the same machine
as Home Assistant.

## Skills

Manage skills under **Settings → Agent → Skills**.

To install skills, select **Install**. In **GitHub repository**, enter a source
in one of these forms:

- `owner/repo`
- `owner/repo@skill`, to install one skill by name
- a `github.com` address
- an `npx skills add` line

The panel reports when the repository has no skill, has too many skills, or is
not a GitHub repository.

Each skill has an **On** switch and a **Remove** button. Each task is told
which skills are on, and what they are for. A task loads a skill when the task
matches it.

You can also put a folder that contains a `SKILL.md` file in the `skills`
folder of the Monitor's data directory. The panel lists these folders with the
installed skills.

## Search

The desk's **Search** can also ask the agent. Type a question,
a keyword, or a change. Search runs read-only: it can run commands that only
read the system. Nothing that a search runs changes the machine. A request for
a change returns a draft plan.

## Copy for pi

You can turn on **Copy tasks for pi** under **Settings → Agent**. When it
is on, each task is also saved as a session of pi's coding agent, in the
session directory of the Monitor's account. Run `pi -r` in the agent's working
folder to list the sessions. Deleting a task also deletes its copy.

## Privacy

To produce a response, the model provider receives:

- the prompts that you write, and the system prompt, which includes the memory
  index, the list of deployed apps, the enabled skills, and the instructions of
  MCP servers
- the output of the commands that the model reads
- the results of MCP tools
- the attachments of a task, as described in [Attachments](#attachments)

The audit log records permission decisions and changes to settings. It does not
record passwords, API keys, or command output.

---

### Src Content Docs Advanced Monitor Agent (`docs/src/content/docs/advanced/monitor-agent.md`)

---
title: Monitor
description: Reach a server through the Monitor
---

Server Box Monitor runs on a server and sends its status to the App. You can
monitor a host without exposing SSH, and keep push alerts, home-screen widgets,
and the Watch app up to date while the App is closed.

## Prompts for an AI agent

The prompts below are for an AI agent that can reach the server over SSH.
They include configuration details that are easy to get wrong. For example,
an invalid alert rule may be logged but never trigger, leaving you without the
alert you expected.

Replace every placeholder in angle brackets before sending a prompt.

<details>
<summary>Install the Monitor</summary>

```text
Install the ServerBox Monitor on <host> via SSH.

The installer is
https://raw.githubusercontent.com/lollipopkit/flutter_server_box/main/monitor/install.sh
It detects the init system automatically. When piped to `sh`, it installs a
`systemctl --user` service for my user. On Alpine, use `sudo sh` so it can
write to /etc/init.d; the Monitor still runs as the user who invoked sudo.

Do not install it as a root system service. Whoever signs in to the Monitor
may do what the account it runs as may do; as root, that is the whole
machine.

Do not add `full_access`, `listen_public`, `roots`, or an `enabled` key
under `[remote_access]` to config.toml. The Monitor does not read them: there
are no per-feature permissions to configure.

When you finish, report:
- the path of config.toml and of the SQLite database beside it
- the path of initial-admin-credentials.txt. Do not print what it contains.
- the address and port it listens on
- what `loginctl show-user <user> -p Linger` says. Without linger a --user
  service stops when I log out.
- the mode of config.toml and of the database. The config can hold push
  credentials and the database holds the Monitor's password hash, so neither
  should be group- or world-readable.
```

</details>

<details>
<summary>Prepare the machine for remote access</summary>

```text
Prepare the ServerBox Monitor on <host> for
<a terminal / file browsing / commands / port forwarding> from the app.

Before changing anything, explain the consequences and wait for my approval.

Keep these details in mind:

- There are no permissions to turn on. Whoever signs in to the Monitor may do
  what the system account it runs as may do. Do not move it to root to make
  something work; tell me what that account lacks instead.
- Everything beyond reading the numbers needs TLS or a loopback caller, and
  a reverse proxy on the same host counts. If the Monitor binds 127.0.0.1, or
  a same-host proxy terminates TLS, nothing more is needed. Only consider
  `[remote_access] allow_insecure = true` if the Monitor is reached directly
  over plaintext from another machine, and say so before you do.

Restart the Monitor after changing config.toml. Then tell me what you changed.
```

</details>

<details>
<summary>Add an alert rule and a notification channel</summary>

```text
Add an alert rule to the ServerBox Monitor on <host>.

What I want to be alerted about: <describe it>

Use this exact rule format:

- A rule is a `[[monitoring.rules]]` table with `name`, `monitor_type`,
  `matcher` and `threshold`.
- `monitor_type` is one of cpu, memory, swap, disk, network, temperature.
  `mem`, `net` and `temp` are accepted as well. Anything else is logged and
  the rule will never fire.
- `matcher` picks part of the metric: `cpu0` for a single core,
  `used`/`free`/`avail` for memory and swap, `rx`/`tx` for network. Disk
  and temperature ignore it entirely.
- `matcher` is NOT an interface name or a mount point. A network rule with
  `matcher = "eth0"` silently measures total rx+tx instead of that
  interface.
- `threshold` is a comparator, a value and a unit: `>=80%`, `<10%`,
  `>10m/s`, `>=70c`. A threshold with no comparator means `<`, so `80%`
  reads as "below 80 percent".
- The unit has to fit the metric: `%` for cpu/memory/swap/disk, `c` for
  temperature, a size or a size with `/s` for network. Sizes are base 1024
  and lowercase. A mismatch is logged and never fires.

If I also asked for a notification channel, add a `[[push]]` table for it.
`push_rate` in config.toml limits notifications per channel, not per rule.

The Monitor reads rules and channels at startup, so restart it afterwards. Then
show me exactly what you wrote.
```

</details>

<details>
<summary>Work out why a feature is missing in the app</summary>

```text
The ServerBox app does not offer <what> for the server connected to the
Monitor at <host>. Find out why, and tell me what you find before
changing anything.

- The App offers what the Monitor reports. `GET /api/v1/capabilities` with a
  login shows `access`: `ok`, and when it is false, `why`.
  `insecure_transport` means it needs TLS or a loopback caller, or
  `[remote_access] allow_insecure`. The machine pages it serves are listed
  under `features`.
- Signing in allows what the system account the Monitor runs as may do. A
  command, file or port that account cannot reach fails.
- Files are browsed and transferred through the Monitor's file API, without
  SSH. Like the terminal, it needs TLS or a loopback caller.
- A Monitor older than the relay or the listener offers no port forwarding
  or remote desktop. Update it.
- The `access_log` table in the Monitor's SQLite database records the visitor,
  time, source, requested resource and result. It never records credentials.
```

</details>

## SSH or Monitor?

| | SSH | Monitor |
|---|---|---|
| Requires additional software on the server | No | Yes |
| Status and charts | Yes | Yes |
| History from before the App connected | No | Yes |
| Terminal, commands, file browsing and transfers | Yes | Yes, as the account the Monitor runs as |
| Port forwarding (local, dynamic, remote) and remote desktop | Yes | Yes |
| Push alerts, home-screen widgets, and Watch app | No | Yes |

SSH is usually the simplest way to connect. Use the Monitor if SSH is
unreachable from your current network, if you need charts to include data
collected before the App connected, or if you want server alerts on your
phone.

You can use both methods for one server. Configure SSH in the App and run
the Monitor on the host to provide widgets, Watch app data, and alerts.

## Install the Monitor

Install a published `monitor-v*` release when available, or build the Monitor
from source. Releases are created by a manually dispatched workflow. For an
unreleased build or an offline install, provide a local package through
`SBM_INSTALL_PKG`.

The installer detects the init system automatically:

```sh
# systemd: install a `systemctl --user` service running as the current user
curl -fsSL https://raw.githubusercontent.com/lollipopkit/flutter_server_box/main/monitor/install.sh | sh -s -- install

# No downloadable release, or an offline installation
curl -fsSL https://raw.githubusercontent.com/lollipopkit/flutter_server_box/main/monitor/install.sh | SBM_INSTALL_PKG=/path/to/server-box-monitor sh -s -- install

# OpenRC (Alpine): writing /etc/init.d needs root, but the Monitor runs as
# the user who invoked sudo
curl -fsSL https://raw.githubusercontent.com/lollipopkit/flutter_server_box/main/monitor/install.sh | sudo sh -s -- install
```

Arguments after `sh -s --` are passed to the installer; use the same pattern
for `uninstall` and `upgrade`. The script is also in the repository, so you
can run `./monitor/install.sh install` from a checkout root. That uses the
checked-out script, which may differ from the version fetched from `main` by
the commands above.

The Monitor runs as an ordinary user by default. Whoever signs in may do what that user may do, so the account the Monitor runs as sets the limit; see [Access](#access). Adding `--system` (with `sudo`) installs it as root instead, and signing in then means a root shell.

The Monitor reads `config.toml` from the directory beside its binary. See
[`config.example.toml`](https://github.com/lollipopkit/flutter_server_box/blob/main/monitor/config.example.toml)
for every available option. By default, the Monitor listens on `0.0.0.0:3770`.
If `frontend/dist` is present, it also serves the web panel from that address.

Collection intervals, alert rules, notification channels, data retention, and
allowed panel origins can be edited without opening `config.toml`. Use
**Server Settings** in the web panel, or open the server in the App and tap
the settings button in the top bar. Both interfaces update the same Monitor and
configuration file.

The JWT secret, `database_url`, and `[remote_access]` options (plaintext
tolerance, SSH address, and size limits) can only be changed in the
configuration file.

The editor never returns stored secrets such as ServerChan or Bark keys, an
iOS push token, an `Authorization` header, an SMTP password, a Telegram bot
token, a Discord webhook URL, or an ntfy token. It shows that each value is
*set* while leaving the field empty. Leave it empty to keep the existing
secret, or enter a replacement.

Changes to notification channels, alert rules, the collection interval, data
retention, and allowed origins take effect after a restart. The extended cycle
interval and both idle-pause settings apply immediately. The App marks any
setting that needs a restart.

If other devices need to connect to the Monitor, protect the connection with
HTTPS. Configure built-in TLS under `[server.tls]` or use a reverse proxy. A
self-signed certificate is shown by the App on the first connection; once
trusted, only that exact certificate is accepted, and a different one is shown
again for review.

### Upgrade

Run this on the server as the account the Monitor was installed from:

```sh
curl -fsSL https://raw.githubusercontent.com/lollipopkit/flutter_server_box/main/monitor/install.sh | sh -s -- upgrade
```

It installs the newest `monitor-v*` release and keeps `config.toml` and the
database. Without `--user` or `--system`, the installer finds the installed
form itself: a `systemctl --user` unit, a system unit, or an OpenRC service.
For the last two it runs itself again through `sudo`, which asks for the
password. When it finds no installation, as for a Monitor in Docker, it changes
nothing; for Docker, pull the new image and recreate the container.

The Monitor upgrades in place: the new files replace the old ones while it runs,
and it restarts last. So the command can run in a terminal the Monitor itself
opened; that terminal closes when the Monitor restarts, and the Monitor is back
within a few seconds.

#### Update from the panel or the App

The Monitor checks its releases every 12 hours and leaves a notification when a
newer one is out. It knows how it was installed: by `install.sh`, in a
container, by the NixOS module, or otherwise. Only the first can update itself;
the others are told how to update instead.

The update runs apart from the Monitor: under systemd as a transient service of
its own (`systemd-run`), elsewhere in a session of its own. The Monitor's restart
ends every connection through it, the panel's and the App's included, but not
the update. The output goes to `update.log` in the Monitor's directory, and the
Monitor that comes back reports how it went. Under OpenRC the installer needs
root, so the Monitor asks for the sudo password; it is used once and not saved.

- **Panel**: **Settings → Server → ServerBox Monitor** shows the version and
  the newest release, with **Check now** and **Update now**. While the update
  runs, the page shows its output, says when the Monitor is restarting, and shows
  the new version when it is back. Clicking the notification opens this page.
- **App**: the **Monitor** tab marks a Monitor with a newer release, and one too
  old for the App to sign in to. Tapping the mark opens the same steps with
  **Update now**. A Monitor too old to sign in to with the password alone still
  asks for an account name: the App asks for it (often `admin`), signs in once
  with it and the saved password, and starts the same update through that
  Monitor's command endpoint. The name is not saved. When the App reaches the
  server over SSH and the Monitor cannot start the update itself, the App runs the
  command in an SSH terminal, which the restart does not affect.

## How far back the App can ask

The available chart range depends on how long the Monitor retains data and
how much history it has collected. The App shows only the ranges the Monitor can
provide. For API fields and history-query behavior, see
[Monitor API and access model](/docs/development/monitor-agent/).

## Panel credentials

The Monitor has one account, signed in with its password alone; there is no
username. The password is stored in the Monitor's SQLite database, not in
`config.toml`. The `jwt_secret` in that file signs session tokens; it is not a
password.

Run the commands below from the Monitor's working directory and as the account
that runs the service: `/opt/server-box-monitor` for a root-owned service, or
`~/.local/share/server-box-monitor` otherwise. Both `config.toml` and the
database path are relative to this directory. Running a command elsewhere
would create a new default configuration and empty database, then update a
database the service does not use.

### The first password

On its first start the Monitor sets a random password. The password is written
next to the database in `initial-admin-credentials.txt`, with mode 0600 on
Unix:

```sh
cd /opt/server-box-monitor
cat initial-admin-credentials.txt
```

Change the password and delete this file. If the database is later removed or
moved and has no account while the file remains, the Monitor stops instead of
overwriting the original credentials with a new set.

### Change or reset a password

```sh
cd /opt/server-box-monitor
./server_box_monitor password
```

The command prompts for the new password twice without displaying it. It
requires at least 8 characters. If the database has no account yet, the
command creates it.

To set the password from an environment variable, use the following in a
script or when you want to keep it out of shell history. This uses Bash or
Zsh: `read -s` is not available in POSIX `sh`. The check prevents a failed or
empty read from setting an empty password:

```bash
read -rsp 'Password: ' SBM_PW && echo
[ -n "$SBM_PW" ] || { echo 'no password entered' >&2; exit 1; }
SBM_PW="$SBM_PW" ./server_box_monitor password --password-env SBM_PW
```

The command deliberately has no password argument: command-line arguments
can appear in `ps` output and shell history.

A password change signs out everything else:

- **Logins and paired devices, at once, whichever way the password was
  changed.** Logins from before the change are refused from the next request,
  and paired widgets and Watch are unpaired. No restart is needed for this,
  and `jwt_secret` does not need to change.
- **Open terminals, port forwards and listeners, at once when the password is
  changed from the App or the panel.** The command above writes the database
  and cannot reach the running Monitor, so connections already open under the
  old password keep running until the Monitor restarts: `systemctl --user
  restart server_box_monitor`, or `rc-service server-box-monitor restart` on
  OpenRC. Restart it after a reset made because the password may be known to
  someone else.

The password can also be changed from the App (the server's settings button,
then **Access**) or the panel; both ask for the current password. Changing it in the App updates the password the App has
saved for that server.

After changing the password on the server, update **Monitor Password** in the
App and replace it in any other client that uses it. Clients are not notified
about password changes and cannot sign in until their saved credentials are
updated.

### A forgotten password

There is no password recovery flow in the panel. Reset the password on the
server with the command above.

Login attempts are rate-limited. Each sign-in gives the App or the browser a
device token, sent with every later sign-in. A device that has signed in
before is limited by its source address and on its own, so failed attempts
from anywhere else cannot lock it out; any other client is limited by its
source address and by a counter all of them share. Per address and per device,
the first three failures have no delay; the shared counter allows twenty.
After that, the delay doubles from one second up to five minutes. A forgotten
password may therefore make the Monitor appear slow or unresponsive. Changing
the password forgets every device.

## Add it in the App

1. Tap **+** to add a server.
2. Enable **Monitor HTTP**. This connection is independent of SSH, so you can
   enable either transport or both. If both are enabled, set **Preferred
   transport** to choose which one the App tries first.
3. Enter:
   - **URL**: for example, `https://1.2.3.4:3770`
   - **Monitor Password**: the Monitor's password — see [Panel credentials](#panel-credentials)
   - **Monitor Certificate**: for a self-signed certificate, review and trust it here, or on the first connection
4. Save the configuration.

Monitor HTTP does not configure SSH credentials. With no SSH connection, the
App can reach the server only through capabilities that the Monitor exposes.

## The Monitor tab

The App's **Monitor** tab shows every server added through the Monitor.
A fresh install does not put the tab in the bar: open it from **More**, or add
it under **Settings › Application › Home Tabs**. On a wide window the sections
and the servers are in a column on the left; on a phone the section is picked
from the bar's title and the server from its server button.

- **Overview**: each Monitor, whether it answers, its version (with the newest
  release when it is older), the [alert rules](#alert-rules) firing now with
  the reading and how long they have fired, and shortcuts to unread
  notifications and to web apps that are down or have an update.
- **Web apps**: see [Monitor web apps](../monitor-apps/#open-apps-from-the-serverbox-app).
- **Notifications**: what the Monitors reported, newest first, in the App's
  language: a rule that started firing, a web app down, back or with an
  update, a disk, array or pool in trouble. Read state is shared with the panel.
- **Audit log**: one server at a time. Sign-ins (accepted and refused, with the
  address), terminals, commands, file writes, machine management, deployments
  and the rest, filtered by type and result. It is shown only over a link the
  Monitor lets act (HTTPS, loopback, or `allow_insecure`).
- **Sessions & devices**: one server at a time. Terminal sessions,
  connections relayed through the Monitor (forwarded ports, desktops, consoles),
  watch and widget tokens, and the devices that signed in with the password.
  A session or connection can be ended and a token revoked. Forgetting a device
  makes its next sign-in count against the account-wide limit on failed
  attempts; it does not sign the device out, since a device that has the
  password signs in again. To keep a device out, change the password.

A Monitor older than a section says so instead of showing it.

## Integrated GPU monitoring

On Linux, the Monitor reads AMD integrated GPU metrics through the kernel's
DRM/sysfs interfaces; an APU does not need ROCm, `amd-smi`, or `rocm-smi` to
report utilization. Intel GPU utilization requires `intel_gpu_top`, usually
provided by the `intel-gpu-tools` package.

Neither the App nor the Monitor prompts for an interactive `sudo` password
during collection. If the SSH or Monitor account cannot read Intel GPU
performance counters, the GPU remains listed and unavailable values are left
out. To collect utilization, grant that account the appropriate GPU PMU
permission for the Linux distribution.

Each Linux GPU is identified by its PCI address, for example
`0000:00:02.0`. Systems with multiple integrated or discrete GPUs therefore
show a distinct, stable entry for each device.

<a id="permission-switches"></a>
<a id="accounts-and-permissions"></a>

## Access

Signing in to the Monitor allows what the operating-system account the Monitor
runs as may do: commands, processes, systemd, containers, snippets, power,
scheduled tasks, the firewall, the terminal, files, remote desktop, port
forwarding, and the web panel's Proxmox VE, libvirt and BMC pages. There are
no roles or per-feature permissions; that account is the limit.

The installer therefore runs the Monitor as an ordinary user by default. With
`--system` it runs as root, and signing in then means a root shell. To limit
what the Monitor can reach, install it as an account that can reach only that.

Whatever that account can reach, the file API never serves the Monitor's own
files — its database, `jwt.secret`, `credentials.key`, `config.toml` and its
backups, `.env`, the TLS key and certificate, and the custom commands — since
they hold credentials.

The credentials the Monitor stores (BMC and Proxmox VE passwords, Agent mode
provider keys, MCP tokens, the WebDAV password) are encrypted in the database
with `credentials.key`, kept beside it. Copy the two together when moving the
Monitor by hand; without the key, those credentials have to be entered again. A
settings backup does not need the key.

### Upgrading from a Monitor with several accounts

Earlier Monitors had several accounts, with roles and grants. On upgrade the
oldest admin account's password becomes the Monitor's password. The other
accounts' Agent mode tasks, memory and desk themes move to it; their desk
layout, windows and paired watches are removed. Roles and grants are not
carried over.

The `config.toml` keys of that model — `full_access`, `listen_public`,
`[remote_access.terminal] enabled`, `[remote_access.fs] enabled`, and
`[remote_access.fs] roots` — are not read and can be deleted.

### Plaintext HTTP

Everything beyond reading the numbers needs HTTPS or a caller on the same
host, which includes a reverse proxy there. On a private network that already
encrypts traffic, such as Tailscale, set `[remote_access] allow_insecure =
true` and enable **Allow insecure HTTP** for this server in the App; both are
required. Legacy `[remote_access.terminal] allow_insecure` and
`[remote_access.fs] allow_insecure` keys are also accepted as aliases for
`[remote_access] allow_insecure`.

For path validation, endpoint behavior, and error codes, see
[Monitor API and access model](/docs/development/monitor-agent/).

## Unsupported features

A server where the Monitor leads (the Monitor alone, or both with the Monitor preferred)
runs every port forward through the Monitor and never falls back to SSH. A
dynamic forward is a SOCKS5 proxy on your device; each connection it carries
is dialled from the server.

A Monitor older than the relay or the listener offers no remote desktop or
port forwarding; update it.

## Widgets, push, and the Watch app

Widgets, push notifications, and the Watch app read from the Monitor, so the
App does not need to stay in the foreground:

- **Home-screen widgets**: Configure the server in the App after installing the Monitor. The widget selects from the server list published by the App; you do not enter a URL manually.
- **Watch app**: It can show only servers with the Monitor configured. These servers sync by default, and you can exclude individual servers in the iOS settings.
- **Push alerts**: A rule decides when to alert and a channel decides where it goes — `[[monitoring.rules]]` and `[[push]]` in `config.toml`, or the same two lists in the App and the web panel, where a channel also has a **Send a test** button. See [Alert rules](#alert-rules) for how a rule is written.

## Notification channels

A `[[push]]` entry has a `name`, a `push_type` and that type's settings.
`{{message}}` and `{{name}}` (this server's name) are replaced in the text
fields. Every type is listed in
[`config.example.toml`](https://github.com/lollipopkit/flutter_server_box/blob/main/monitor/config.example.toml).

| `push_type` | Required | Optional |
| --- | --- | --- |
| `webhook` | `url` | `method`, `headers`, `body_template` |
| `serverchan` | `sc_key` | `title`, `desp` |
| `bark` | `key` | `server`, `title`, `subtitle`, `body`, `markdown`, `level`, `volume`, `badge`, `sound`, `icon`, `image`, `group`, `url`, `copy`, `auto_copy`, `call`, `is_archive`, `ttl`, `action`, `cipher_key` |
| `ios` | `token` | `title`, `content` |
| `smtp` | `host`, `from`, `to` | `port`, `security`, `username`, `password`, `subject`, `body` |
| `telegram` | `bot_token`, `chat_id` | `text`, `parse_mode`, `message_thread_id`, `disable_notification`, `disable_link_preview`, `api_base` |
| `discord` | `webhook_url` | `content`, `username`, `avatar_url`, `thread_id` |
| `ntfy` | `topic` | `server`, `title`, `message`, `priority`, `tags`, `click`, `icon`, `attach`, `delay`, `email`, `markdown`, `token`, `username`, `password` |

- **Credentials from the environment**: in `config.toml`, a credential
  (`sc_key`, Bark `key` and `cipher_key`, iOS `token`, a webhook header value,
  SMTP and ntfy `password`, ntfy `token`, `bot_token`, `webhook_url`) may name
  an environment variable as `${NAME}`, alone or inside the value
  (`Authorization = "Bearer ${HA_TOKEN}"`); `$${` writes a literal `${`. It is
  read when a notification is sent, from the Monitor's environment or its
  `.env`; `config.toml` keeps the reference. A channel whose variable is unset
  or empty is refused on save and fails to send, naming the variable. Other
  settings are not expanded. A credential entered in the App or the web panel
  is taken as typed, never as a reference: signing in does not give access to
  the Monitor's environment.
- **Bark**: with `cipher_key` set, the notification is encrypted with AES-CBC
  (a 16, 24 or 32 character key for AES-128/192/256). Enter the same key and
  algorithm under Push Encryption in the Bark app. Only the device key and the
  ciphertext reach the Bark server.
- **SMTP**: `security` is `starttls` (port 587, the default), `tls` (465) or
  `none` (25). With `none`, a password is accepted only for a server on the
  same machine. `to` takes several addresses, comma-separated.
- **Telegram**: with `parse_mode`, the message and the server name are escaped
  for that mode, so only your own `text` is read as markup.
- **Discord**: mentions in the text, such as `@everyone`, do not notify
  anyone.

## Alert rules

Each rule has four fields: `name`, `monitor_type`, `matcher`, and `threshold`.
The metric selects what to measure, the matcher selects which part of that
metric to evaluate, and the threshold sets when to send an alert.

```toml
[[monitoring.rules]]
name = "CPU busy"
monitor_type = "cpu"
matcher = "cpu"
threshold = ">=80%"
```

### Metric and matcher

| Metric | Matcher | Reading |
| --- | --- | --- |
| `cpu` | `cpu` or blank | Usage across all cores |
| `cpu` | `cpu0`, `cpu1`, … | Usage of one core |
| `memory` | `used`, `memory` or blank | Percent used |
| `memory` | `free` | Percent not used |
| `memory` | `avail` | Percent available |
| `swap` | `used`, `swap` or blank | Percent used |
| `swap` | `free` | Percent not used |
| `disk` | Ignored | Percent used across this machine's filesystems; NFS, SMB and similar count only with `disk_counts_network = true` under `[monitoring]` (also in Monitor settings) |
| `network` | `rx` or `in` | Receive speed |
| `network` | `tx` or `out` | Transmit speed |
| `network` | Blank or anything else | Receive plus transmit |
| `temperature` | Ignored | The reading the Monitor reports as the machine's temperature |

Configurations migrated from the Go version of Monitor may also use `mem`,
`net`, and `temp`; other unknown metrics are logged once per cycle and their
rules do not fire.

### Threshold

A threshold combines a comparator, value, and unit. Examples: `>=80%`,
`<10%`, `>10m/s`, and `>=70c`.

| Comparator | Fires when the reading is |
| --- | --- |
| `>=` | At or above the value |
| `>` | Above the value |
| `<=` | At or below the value |
| `<` | Below the value |
| `=` | Exactly the value |

If you omit the comparator, the rule uses `<`. For example, `80%` means
“below 80 percent”; write `>=80%` to alert at or above 80 percent.

The unit must match the metric:

| Unit | Kind | Use with |
| --- | --- | --- |
| `%` | Percent | `cpu`, `memory`, `swap`, `disk` |
| `c` | Temperature | `temperature` |
| `/s` after a size, as in `10m/s` | Speed | `network` |
| `b`, `k`, `m`, `g`, `t` | Size | `network` |

Network sizes use base 1024 and lowercase units. If a unit does not match its
metric, such as `>=80%` on a `network` rule, the Monitor logs the error and the
rule never fires.

### Examples

```toml
[[monitoring.rules]]
name = "Core 0 pinned"
monitor_type = "cpu"
matcher = "cpu0"
threshold = ">=95%"

[[monitoring.rules]]
name = "Memory running out"
monitor_type = "memory"
matcher = "avail"
threshold = "<10%"

[[monitoring.rules]]
name = "Disk filling up"
monitor_type = "disk"
matcher = ""
threshold = ">=90%"

[[monitoring.rules]]
name = "Download burst"
monitor_type = "network"
matcher = "rx"
threshold = ">10m/s"

[[monitoring.rules]]
name = "Running hot"
monitor_type = "temperature"
matcher = ""
threshold = ">=70c"
```

### When a rule stays quiet

- **Network rules need two samples.** After startup, a collection gap, or a
  newly detected interface, the first sample provides no speed value. The
  rule can be evaluated after the next sample arrives.
- **Missing readings skip a cycle.** If memory or disk data is unavailable,
  the Monitor skips that rule instead of treating the reading as zero.
- **Temperature rules need a temperature reading.** Some machines do not
  report one.

Rate limits apply to each notification channel. Configure `push_rate` in
`config.toml` or **Rate limit** in the App.

## Troubleshooting

**A feature is missing or greyed out.** The App offers what the Monitor
reports. Everything beyond reading the numbers needs HTTPS or a caller on the
same host; see [Plaintext HTTP](#plaintext-http). A Monitor older than a
feature does not report it; update the Monitor. Restart the Monitor after editing
`config.toml`.

**An action fails with a permission error.** The Monitor acts as the
operating-system account it runs as, and cannot reach what that account
cannot. See [Access](#access).

**Certificate errors.** Configure valid TLS or put the Monitor behind a reverse proxy. For a self-signed certificate, compare its SHA-256 with the Monitor's (`openssl x509 -in tls.crt -noout -fingerprint -sha256`) and trust it; a changed certificate is shown again.

**The panel uses a different origin.** Add that origin to
`cors_allowed_origins` in `config.toml` or the `SBM_CORS_ORIGINS` environment
variable.

**Login is rejected, or the password is lost.** Reset it on the server with `server_box_monitor password`; see [Panel credentials](#panel-credentials). Repeated failures are throttled, so a wrong password can also present as a slow or unresponsive Monitor.

**A request gets no response.** Confirm that the Monitor is running and its
port is reachable. Then inspect the database's `access_log` table, which
records the visitor, time, source, requested resource, and result without
storing credentials.

---

### Src Content Docs Advanced Monitor Apps (`docs/src/content/docs/advanced/monitor-apps.md`)

---
title: Monitor Apps
description: Install and manage Docker Compose apps through the Monitor panel
---

The Monitor can deploy web apps with Docker Compose and show them in the
panel's App Store and desk. An app runs on the server where the Monitor runs.
Installing, changing, or removing an app asks for the Monitor's password again.
Apps that run inside the panel
itself, installed from `.fsba` packages, are [Desk Apps](/docs/advanced/monitor-desk-apps/).

## Browse and install apps

Open **Apps → App Store** in the panel to browse by category or search by name.
An app page shows its project, publisher, version, licence, requirements, and
what its Compose files do. Select **Install** and complete the app's settings.

Before deployment, the confirmation lists the settings, images to pull, data
folders, and ports. Review these along with the project metadata and licence.
The Monitor asks for your password; acknowledge that this is third-party software
and accept the licence when the app requires it. The Monitor then downloads the
images and deploys the Compose project. The page shows the job's progress.

Some apps build an image on the server from a Dockerfile in the app's package,
because no maintained image exists. Their confirmation lists the built images
under **Built here**, and their base images among the images to pull. A build
takes longer than a download, and an update builds again from the newest base
image of the same release.

After installation, open the app from its page or **All Apps**. To edit its
settings, open the app's page and choose **Change settings**. Saving settings
deploys the app again, so it is briefly unavailable. Data already in an old
data folder is not moved to a newly selected folder.

### Ports

The Monitor checks every configured port against other containers and the
app's own running containers. For a suggested port, it chooses another free
port if the suggestion became occupied before deployment. A port you chose
explicitly is refused if it is occupied. Starting, restarting, updating, or
saving settings does not silently change a chosen port.

Port checks are partial when the Monitor cannot see the host's network namespace,
such as when the Monitor runs in a container, and for Windows host ports when the Monitor runs under WSL.
Check host port availability yourself in those setups. The app page reports
when the Monitor's port check is partial.

## App health and updates

The Monitor checks installed apps about once a minute. It reports apps as healthy,
starting, unhealthy, down, or stopped. While an app job is running, health is
not checked. A desk notification is sent when an app goes down or becomes
unhealthy, when it recovers, and when a newer catalog version is available.
Notifications appear in the panel in the reader's language when the catalog
provides a translated title.

Choose **Update** on the app page to deploy the catalog's current version. An
update is announced once for each catalog version. To check for catalog changes
now, choose **Check for new apps and versions** in the App Store.

### Remove an app

Choose **Remove** on the app page or from its window. By default, the Monitor
removes the app's containers but keeps its data so a later installation can
reuse it. Choose the option to remove data only when you no longer need it;
data paths are deleted and cannot be recovered. Removing an app takes it out
of **All Apps**.

## Where apps come from

The catalog combines three sources. When two sources contain the same app id,
the first source in this list takes precedence:

1. The folder configured by `[stacks] local_apps`, read when the Monitor starts.
2. App repositories, refreshed at Monitor startup and hourly. Use **Check for new
   apps and versions** to refresh manually.
3. Apps shipped with the Monitor.

For example, create `/srv/sbm-apps/example.web/` with a `manifest.toml` and its
Compose files, then configure:

```toml
[stacks]
local_apps = "/srv/sbm-apps"
```

Restart the Monitor after adding or changing a local app. Local app packages are
read from the configured folder; the Monitor does not copy them into the catalog.

## Shared folder and first sign-in

Apps that download, play or serve files use one shared folder, so a
downloader's files show up in a media server's library. Its subfolders are
`downloads`, `media/movies`, `media/tv`, `music`, `books`, `comics` and
`documents`. By default it is `shared/` next to the Monitor's database; set
another location with:

```toml
[stacks]
shared_dir = "/srv/media"
```

Apps run as the owner of that folder, so change its owner to choose which
user's files they create. Removing an app never deletes anything in the shared
folder.

When an app has an administrator account, the Monitor creates it with a
generated password where the app allows that. You can see the account and,
after entering the Monitor's password again, the generated password under
**Sign-in** on the app's page.

## Open apps from the ServerBox app

The **Web apps** section of the app's [Monitor tab](../monitor-agent/#the-monitor-tab)
lists the apps deployed on every server added through the Monitor,
grouped by server, with their health. An app with a newer version in the
catalog comes first, and the update button in the bar shows only those. A
server's own page also has a **Web apps** card with that server's apps.

Tap an app to open it, or its info button for its page (health, description,
version, homepage, and the **Open** button).

Tap an app to open it in the device's browser: the app asks the Monitor for a
single-use ticket and the browser enters the app through the Monitor's proxy,
as a panel window does. From then on the browser talks to the proxy with a
session of its own, so the ServerBox app may go to the background or be
closed. Deploying, updating and removing apps stay in the panel.

The browser checks the Monitor's TLS certificate itself: a certificate trusted
in the app is not trusted by the browser, so a self-signed one shows the
browser's warning. The proxy ports (or the apps host below) must be
reachable from the device.

## App windows and reverse proxies

By default, each deployed app has its own proxy port in the range 3780–3799 on
the Monitor's host. The panel enters the app through that proxy. These ports need
to be reachable by the browser; if the Monitor is behind a reverse proxy or
Cloudflare Tunnel, configure the apps host listener instead:

```toml
[stacks]
apps_url = "https://*.apps.example.com"
apps_port = 3779
```

`apps_port` defaults to `3779`. Create wildcard DNS for
`*.apps.example.com` pointing at the proxy or tunnel, and use a TLS certificate
that covers the wildcard. Each app gets a host such as
`futo-immich.apps.example.com`. The proxy must preserve the incoming `Host`
header and support WebSocket upgrades.

For Caddy, use a certificate already issued for the wildcard (or configure a
DNS challenge with a suitable provider plugin):

```text
*.apps.example.com {
    tls /etc/caddy/certs/apps.example.com.pem /etc/caddy/certs/apps.example.com-key.pem
    reverse_proxy 127.0.0.1:3779
}
```

A minimal nginx virtual host is:

```nginx
server {
    listen 443 ssl;
    server_name *.apps.example.com;
    ssl_certificate /etc/nginx/certs/apps.example.com.pem;
    ssl_certificate_key /etc/nginx/certs/apps.example.com-key.pem;

    location / {
        proxy_pass http://127.0.0.1:3779;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
```

For Cloudflare Tunnel, route the wildcard hostname to the local apps listener:

```yaml
ingress:
  - hostname: "*.apps.example.com"
    service: http://localhost:3779
  - service: http_status:404
```

If the panel is hosted on Cloudflare Pages, give it a custom domain on the
same site as the apps, for example `panel.example.com` alongside
`*.apps.example.com`. Safari blocks the apps' login cookies when the panel is
opened on `*.pages.dev`; other browsers retain them using partitioned cookies.
If you run multiple Monitors, give each Monitor its own wildcard domain and
certificate.

## Container backups

Open **Containers → Backups**, select a container, and choose **Back Up**. You
can back up one container or its whole Compose project. The archive contains
its volumes and bound folders. The Monitor skips bound system folders (for
example `/` and `/etc`) and bound files; the panel lists skipped mounts. You can
ask the Monitor to stop the containers while archiving, which helps avoid copying
a database while it is being written. The Monitor starts the containers again
after archiving, including when the archive job fails.

To restore, select a backup and choose **Restore**. The Monitor stops the
containers still present in the project, clears each restored mount, and
unpacks the archived data there. Restore and delete ask for your password.

By default backups are kept on the Monitor host under the database directory at
`container-backups/<backup-id>/`, with metadata in `meta.json`. To keep them on
a separate disk, mount it in **Storage** with **Let ServerBox write here**, then
choose **Where backups go → Change** in **Containers → Backups** and pick a
folder on it. The Monitor writes into `serverbox-container-backups/` there.
Backups already made stay where they are.

**Backups kept of each** sets how many backups of each container or project are
kept; after each backup the oldest beyond that number are removed. A backup is
refused when the destination has less free space than the data to archive.

To back up regularly, choose **Repeat → Every day** or **Every week** and a time
in the **Back Up** dialog. Schedules run at the server's local time and are
listed under **Scheduled** with the result of their last run.

## Storage

The **Storage** app (Linux) lists the server's disks, partitions,
filesystems and mounts, its software RAID arrays (mdadm) and ZFS pools. From it
you can:

- partition a whole disk (one GPT partition) and format it as ext4, xfs or btrfs;
- mount a filesystem, optionally with an `/etc/fstab` line so it is mounted at
  every start (the previous file is kept as `/etc/fstab.sbm-bak`), and unmount it;
- create a RAID array, add or remove a member, grow a RAID 1, 5 or 6 by one
  more working member, delete an array, and format and mount the array itself;
- create a ZFS pool (it grows by itself once its disks are replaced by larger
  ones), add disks or a spare to it, replace a failed or smaller device,
  mirror a device, bring an offline device back, take a spare out, scrub it,
  destroy it;
- grow a partition into the free space after it (a VM's disk made larger), and
  expand a mounted ext4, xfs or btrfs filesystem after the array or partition
  under it grew;
- format a partition or disk encrypted (LUKS2, with a passphrase), and lock and
  unlock it. An encrypted disk is not unlocked at boot: after a restart, unlock
  it and mount it again in Storage;
- read every disk's SMART health (temperature, hours powered on, bad sectors,
  the last self-test), see every attribute and self-test in **Details**, and
  start a short or long self-test on a disk that has SMART.

Every change asks for the sudo password of the Monitor's account and runs as
root. A disk or partition that is mounted, used as swap, or a member of an
array or pool is never partitioned, formatted or built on, nor is a firmware partition (EFI system, BIOS boot). What the system is mounted from (`/`, `/boot`, `/boot/efi`) is never unmounted. Partitioning,
formatting and building an array or pool erase what is on the disks; the
confirmation names them. mdadm, ZFS (`zfsutils-linux`) and smartmontools must be
installed for their parts to show.

Reading SMART needs root too: the app reads it on its own where sudo asks no
password, and otherwise when you click **Read disk health**.

### Maintenance and alerts

Under **Maintenance**, three tasks can run weekly or monthly: scrubbing every
ZFS pool and checking every RAID array, a short SMART test and a long SMART
test on every disk that has SMART. **Run now** starts one at once.

The schedule runs without a password. If the Monitor does not run as root, sudo
must allow its account these commands without one; the page shows the line,
for example in `/etc/sudoers.d/serverbox-storage`:

```
serverbox ALL=(root) NOPASSWD: /usr/sbin/smartctl, /usr/sbin/zpool scrub *, /usr/sbin/mdadm --action=check *
```

The Monitor also watches the storage: every five minutes the arrays and pools,
and every hour each disk's SMART (with the same sudo rule, or from the last
reading made on the page). A degraded array, a pool that is not online, a disk
whose SMART check or self-test failed, or a disk with more bad sectors than
before is reported in the notification center and through the push channels
(**Settings → Notification channels**). An array or pool that recovers is reported in
the notification center.

## Sharing

The **Sharing** app (Linux) serves folders to other computers over SMB
(Samba: Windows, macOS, Linux) and NFS (Linux, macOS). When Samba or the NFS
server is missing, the app offers to install it with the machine's package
manager (apt, dnf or apk).

- **SMB**: add a share with a name and a folder, optionally read only, open to
  guests (no account), or limited to some accounts. Samba keeps its own
  passwords: set an SMB password for each account that connects under
  **SMB passwords**. A share can take Time Machine backups from a Mac, and keep
  deleted files in a `.recycle` folder inside it.
- **NFS**: export a folder to clients (`*`, a host, an address or a network
  such as `192.168.1.0/24`), each read only or read and write, and what root
  on the client becomes (nobody by default).

ServerBox keeps the shares it makes in files of its own
(`/etc/samba/serverbox.conf`, included from `smb.conf`, and
`/etc/exports.d/serverbox.exports`) and lists shares set up elsewhere without
changing them. Every change asks for the sudo password and is checked
(`testparm`, `exportfs -ra`) before it takes effect; a change that does not
check leaves the previous configuration in place. **Connected now** lists who
uses the shares (it asks for the sudo password: Samba tells only root).
**Allow in Firewall** opens the Firewall app with TCP 445 (SMB) or 2049 (NFS)
proposed as a rule to let in, to confirm there. Pick a share's folder from the
disks mounted in Storage, or type any.

---

### Src Content Docs Advanced Monitor Backup (`docs/src/content/docs/advanced/monitor-backup.md`)

---
title: Monitor Settings Backup
description: Back up the Monitor's settings to a WebDAV folder, encrypted with your passphrase, and restore them
---

The Monitor can back up its own settings to a WebDAV folder: the account
password, snippets, remote desktops, BMC and PVE connections, desk preferences
and themes, Agent mode settings, push channels and monitoring rules. Metrics
history, the audit log, sessions, installed packages and deployed web apps are
left out.

Open **Settings → Settings backup** in the panel.

## Set it up

1. Enter the folder's address (one folder per server, for example
   `https://dav.example.com/serverbox/web-1/`), the user name and the password,
   and press **Test**. The folder is made on the first backup.
2. Press **Save** and enter the panel password.
3. Press **Set passphrase**. The first backup is made right after.

The address must be HTTPS. Plain HTTP works to the same machine, or to another
one after you turn on **Allow plain HTTP**; the backups stay encrypted, but the
WebDAV password is sent unencrypted.

## How backups are made

- The settings are checked every 10 minutes. A backup is made when they
  changed, and once a day when only values that change on their own did (the
  last run of a schedule, refreshed sign-in tokens).
- The newest 10 are kept (change it under **Backups kept**). A backup can be at
  most 100 MB. Each server's files carry its own id (`<server>`), so servers
  sharing a folder never remove each other's backups.
- When a backup fails, the desk and the push channels say so once; the desk
  says so again when backups work again.

## Encryption

Each backup is a [age](https://age-encryption.org) file encrypted to a key. The
key's secret half is in the folder too, as `serverbox-monitor-key-<server>-<id>.age`,
encrypted with your passphrase. The Monitor keeps only the public half, so it
backs up without the passphrase and cannot read its own backups.

**If you lose the passphrase, the backups cannot be restored.** A new
passphrase applies to backups from then on; older backups keep the passphrase
they were made with.

The files are plain age, so you can open them without ServerBox:

```sh
age -d serverbox-monitor-key-<server>-<id>.age > key.txt   # asks the passphrase
age -d -i key.txt serverbox-monitor-<server>-<time>-<id>.tar.gz.age | tar -xz
```

The archive holds `manifest.json`, `config.toml`, `settings.db` (SQLite) and
the files the settings name (`blobs/`).

## Restore

In the panel, press **Restore** next to a backup and enter its passphrase, then
the panel password. The settings are replaced; the server's history, its
listen address, TLS files, database location and where backups go stay. The
account password becomes the one in the backup, so every device signs in
again. A Monitor run as a systemd service (as the installer sets it up) or under
OpenRC restarts by itself; otherwise, in a container too, restart it.

On a new machine, before or after installing the Monitor, restore from the
command line in its working directory:

```sh
server_box_monitor backup restore --url https://dav.example.com/serverbox/web-1/ --user me
```

It asks the WebDAV password and the passphrase (or reads them from the
variables `--password-env` and `--passphrase-env` name), restores the newest
backup (`--name` picks another; a folder several servers back up to needs it),
and keeps backing up to the same folder as that server.
`server_box_monitor backup list` lists the backups and `backup run` makes one
now.

---

### Src Content Docs Advanced Monitor Desk Apps (`docs/src/content/docs/advanced/monitor-desk-apps.md`)

---
title: Desk Apps
description: Install third-party apps in the Monitor panel's desk
---

The [Monitor](/docs/advanced/monitor-agent/)'s web panel is a desk with
apps in windows. Besides its own apps, you can install third-party apps from `.fsba` packages. These are different from
[Monitor Apps](/docs/advanced/monitor-apps/), which deploy Docker Compose
services on the server.

An installed app runs in a sandboxed frame of the panel. It has no network
access and cannot use the Monitor's API. It reaches the desk only through what
its permissions allow: its window, notifications, and storage of its own. An
app of the `wasm` kind also has a backend that the Monitor runs, which can read
the server's status, run programs, or run scripts as root when its
permissions allow. Before anything runs as root the desk shows its own dialog,
naming the app and what it says it does, and asks for sudo's password; the
password goes to the Monitor with that request, never to the app.

## Install an app

The **App Store** lists the desk apps the Monitor offers, those ServerBox signed
marked **ServerBox** and others **Unknown publisher**. **Install** shows what
the app asks for and installs and approves it with your password.

A package from elsewhere:

1. Open **Settings → Apps** in the panel.
2. Under **Installed**, select **Install…** and choose the `.fsba` package.
   The Monitor checks the package and refuses it when the check fails, for
   example a manifest with an unknown field or an entry outside the package.
3. The app is listed as **Waiting**. Select **Approve**, read what it asks
   for, and enter your password.

After approval the app appears in **All Apps**. Other open desks see it the
next time they start.

Every new package waits for approval again, including a newer version of an
approved app, even when it asks for the same permissions. The row shows the
version and the first characters of the package's SHA-256, so you can compare
it with what the publisher lists.

## Permissions

| Permission | Allows |
|---|---|
| `notifications` | Showing notifications on the desk |
| `background` | Running while its window is hidden |
| `status` | `wasm` only: reading the server's status |
| `process` | `wasm` only: running programs as the Monitor's system account |
| `root` | `wasm` only: running scripts as root, each time after you confirm in the desk's dialog with sudo's password (it can be remembered for 15 minutes) |

What a backend may do is bounded by the permissions the app was approved with
and by the Monitor's transport rule: `process` and `root` need HTTPS or a
caller on the same host, as the rest of the Monitor does. They reach what the
system account the Monitor runs as can reach; see
[Access](/docs/advanced/monitor-agent/#access).

An approved app can read whatever its permissions allow. The sandbox blocks its network requests, but it
cannot stop an app from sending what it has read elsewhere by navigating its
frame. Install apps only from publishers you trust.

## Use and remove an app

Each app has a page under **Settings → Apps → All apps**: whether it is in the
dock, whether it keeps running while hidden (when it has the `background`
permission), and the permissions it was approved with.

**Remove** under **Installed** removes the app, together with what was stored
in it.

## Build an app

See [Developing Desk Apps](/docs/development/desk-apps/).

---

### Src Content Docs Advanced Program Status (`docs/src/content/docs/advanced/program-status.md`)

---
title: Program Status
description: See when a program in a terminal is waiting for you, has finished or has failed
---

A program running in a terminal can tell Server Box what it is doing: running,
waiting for you, finished or failed. Server Box shows that next to the
terminal's name and, when the terminal is out of sight, as a notification.

No server-side software is required. The program writes a short escape
sequence to its output, which reaches the App through SSH, a Monitor
terminal, or a terminal on this device, alongside the rest of the output.

## What Server Box reads

| Sequence | Sent by | What it says |
|---|---|---|
| OSC 7501 | Programs that support the [Program Status Protocol](https://gist.github.com/mitchellh/7acae3abd8355c1c00287d67e96c913a) | `idle`, `working` (with progress), `done`, `blocked` (waiting for an approval, an answer or a sign-in) or `error`, with a title and a message |
| OSC 9;4 | systemd, winget and other programs that show a progress bar | Progress, failed, paused |
| OSC 133 | Shells with shell integration, such as fish 4 | A command started, or finished with an exit code |

## Where it is shown

- **A dot before the terminal's name**, in the terminal tab's switcher, its
  list and the side bar: orange while a program waits for you, red when one
  failed, green when one finished, the accent colour while one runs (a ring
  when it reports progress). A program that is only idle shows nothing.
- **The status button** in the terminal's bar lists every report: the
  terminal's own shell first, then each tmux pane. A finished or failed report
  stays until the program replaces it or you clear it there.
- **tmux**: a window's chip takes the colour of its panes' most urgent report,
  and the pane menu shows each pane's report. Panes not on screen are read too.
- **Notifications**: when a terminal is not on screen — another tab, or the
  App in the background — a program starting to wait, finishing or failing
  shows a notification, and so does a command that ran for 30 seconds or more
  ending. Tapping it opens that terminal. Turn it off in **Settings → SSH →
  Notify when a program needs you**.
- **The ongoing notification** on Android and the **Live Activity** on iOS say
  what the session's programs are doing — waiting, finished, failed or running —
  instead of the address. Both can be read without unlocking, so they carry
  only that state, never a program's own title or message, and nothing while
  the notification switch above is off.
- **The Agent** reads the reports along with the screen, so it can tell that a
  program is waiting for an answer.
- **The Monitor's web panel** shows the most urgent report above its
  terminal.

## Reporting from your own scripts

A report is `ESC ] 7501 ; key=value:key=value ESC \`, with `msg` and `title`
encoded in base64:

```sh
status() {
  printf '\e]7501;state=%s:msg=%s\e\\' "$1" "$(printf '%s' "$2" | base64 | tr -d '\n')"
}

status working 'Backing up /srv'
# ...
status done 'Backup finished'
```

`state=clear` removes the report. A `working`, `blocked` or `idle` report is removed
when the program's shell shows its next prompt (with shell integration) or the
session ends; `done` and `error` stay. The full rules, such as `id` for
several reports from one program, are in the
[specification](https://gist.github.com/mitchellh/7acae3abd8355c1c00287d67e96c913a).

## tmux

Server Box attaches to tmux in control mode, which passes every pane's output
through as it is, so reports from tmux panes need no tmux setting.

The Monitor's web panel attaches a regular tmux client. tmux drops
sequences it does not know there, so a report only reaches the panel when
`allow-passthrough` is on (`set -g allow-passthrough on`) and the program wraps
it for tmux (`ESC P tmux; …  ESC \`, with every `ESC` inside doubled).

A program that asks whether the terminal supports reports (`OSC 7501 ; ?`)
gets no answer through tmux, because tmux answers the query that follows it
first. It can send reports anyway.

---

### Src Content Docs Advanced Remote Desktop (`docs/src/content/docs/advanced/remote-desktop.md`)

---
title: Remote Desktop (RDP and VNC)
description: Connect to graphical desktops through SSH or Monitor
---

Server Box includes RDP and VNC clients for Android, iOS, Linux, macOS, and
Windows. It reaches desktops through an existing server connection: SSH or a
Monitor. The desktop port does not need to be exposed to the network
running Server Box.

## Set up a connection

1. Set up the server connection in Server Box with SSH or a Monitor.
   If both are available, the server's **Try first** preference determines
   which connection is tried first; Server Box falls back to the other if it
   fails.
2. Open the **Remote desktop** tab and choose the server, or open the feature
   from that server's detail page.
3. Add a profile for the desktop. Profile names must be unique on that server.
4. Select **Connect** to open or return to a session. Use **Edit** to change a
   profile; **Test** in the editor connects with the current form values and
   replaces that profile's existing session.

The desktop address is resolved from the server's network, not from the phone
or computer running Server Box. The default targets are:

| Protocol | Default target |
| --- | --- |
| RDP | `127.0.0.1:3389` |
| VNC | `127.0.0.1:5900` |

These defaults work when the desktop service runs on the server itself. You can
also enter an internal address reachable from that server. SSH connections use
the same authentication and jump-server settings as terminal and port
forwarding connections. With the Monitor, it connects from its own
machine as the account it runs under. A plaintext HTTP connection to a Monitor
is used only when that connection is to a loopback address.

Passwords are not saved unless **Save password** is enabled. A password entered
for a session stays in memory for that session and its reconnect attempts.
Saved passwords are stored in Server Box's encrypted database and included in
encrypted backups and sync data. They are not included in server QR-code shares.

## Verify an RDP certificate

Server Box first checks the RDP certificate against the platform trust store.
If the certificate is trusted and its name matches the target, the connection
continues without a prompt.

For a self-signed certificate, unknown issuer, or name mismatch, Server Box
stops before sending credentials and shows the certificate identity and
SHA-256 fingerprint:

1. Verify the fingerprint through a separate trusted channel.
2. Select **Trust and reconnect** to trust that certificate for this profile.
3. Later connections accept only the same fingerprint.
4. If the certificate changes, the connection is blocked. Verify the new
   fingerprint before selecting **Replace trust**.

Changing a profile's protocol, target host, or target port clears its saved
certificate trust. Logs and diagnostics do not include passwords, clipboard
text, or certificate contents.

## Use sessions and controls

The **Remote desktop** tab can keep several RDP and VNC sessions open. On wide
windows, the session list appears beside the current desktop and can be resized
or collapsed. On narrow windows, select the session name at the top to switch
sessions.

The viewer offers fit-to-window, 1:1 and fixed zoom levels, full screen,
reconnect, close, view-only mode, clipboard send, a soft keyboard, and
Ctrl+Alt+Delete. Desktop platforms also support physical keyboards, all three
mouse buttons, and scrolling. When keyboard focus leaves the viewer, held RDP
keys are released.

On phones and tablets, touchpad mode is enabled by default: move one finger to
move the pointer, tap to click, use two fingers to right-click or scroll, and
pinch to zoom. Direct-pointer mode maps each touch to the corresponding point
on the remote desktop.

RDP synchronizes text clipboard data in both directions. Classic VNC clipboard
text uses Latin-1; Server Box rejects text that cannot be represented rather
than sending corrupted characters. RDP can adjust the remote resolution to the
viewer. VNC uses the dimensions provided by its server.

## Connection recovery

After a transport failure, Server Box retries after 1, 2, and 5 seconds. Each
attempt checks the connection again and creates a new temporary tunnel that
listens only on a local loopback address. Authentication failures, rejected
certificates, and invalid profile settings are not retried automatically.

When the server names the reason a connection failed or a session ended, Server
Box shows that reason and does not reconnect on its own: a wrong password, a
locked or expired account, an idle or session time limit, a log-off, another
connection taking over the session, or a server shutting down. Retrying would
get the same answer, and taking a session back from another connection would
disconnect that one. Select **Reconnect** once the cause is resolved.

## Troubleshoot xrdp

If the server offers only Standard RDP Security, the connection fails. That
mode uses RC4 and does not authenticate the server, so Server Box requires TLS
or CredSSP/NLA instead. Clients that accept the legacy mode, such as the
Windows client, can still connect. On the server:

1. In `/etc/xrdp/xrdp.ini`, set `security_layer=negotiate` or `tls`, not `rdp`.
2. Make sure xrdp can read the files named by `certificate` and `key_file`. On
   Debian and Ubuntu, the default key is in `/etc/ssl/private` and readable
   only by the `ssl-cert` group: `sudo adduser xrdp ssl-cert`.
3. Restart xrdp: `sudo systemctl restart xrdp`. In `/var/log/xrdp.log`, a line
   such as `Cannot read private key file` means step 2 is still needed.

Desktop platforms and Android use the app's existing background behavior when
the operating system allows it. iOS may suspend network activity in the
background; Server Box checks the session and reconnects if needed when you
return to the app.

## Supported protocols and limits

- **RDP:** TCP, TLS, CredSSP/NLA, graphics, keyboard and pointer input, dynamic
  resolution, and text CLIPRDR are supported. Username/password authentication
  with an optional domain primarily uses NTLM; Kerberos is not guaranteed.
  Standard RDP Security (RC4) is not supported.
- **VNC:** RFB 3.3, 3.7, and 3.8 are supported with None or classic VNC
  Authentication. Classic VNC passwords are ASCII; a longer one is accepted
  and, as in TigerVNC, only its first eight characters are used.
  Supported updates include Raw, CopyRect, ZRLE, Tight, Tight JPEG, cursor, and
  desktop size.
- VNC does not support VeNCrypt, SASL, Apple Remote Desktop authentication, or
  RealVNC proprietary authentication.
- Audio, microphone, multiple monitors, RemoteApp, RDP Gateway, UDP transport,
  and file, disk, printer, USB, or smart-card redirection are not supported.

---

### Src Content Docs Advanced Theme Packages (`docs/src/content/docs/advanced/theme-packages.md`)

---
title: Using Themes
description: Choose, install, and manage themes
---

Server Box includes the Default and AMOLED themes and lets you install more,
such as One Dark Pro, from the theme store or
from a theme file.
Theme settings are under **Settings → Appearance**. The Monitor panel installs
the same theme packages; see [In the Monitor panel](#in-the-monitor-panel).

## Choose a theme

Open **Theme preset** to choose a built-in theme, an installed theme, or
**Custom**. Moving through the list previews themes without saving the change.
Select a theme to apply it. Dismiss the picker to keep the theme you had before
opening it.

Some theme packages contain several variants, such as the Trans, Nonbinary and
Rainbow variants of Pride. Each variant is listed separately, as
`Pride · Trans`, and can be chosen like any other theme. The package is
installed and updated once for all of its variants.

**Custom** lets you choose a local background image and adjust app icons, corner
radii, opacity, and blur. These options are separate from the read-only values
in a packaged theme.

Themes declare which appearance modes they support. Themes that support both
Light and Dark can be used with System, Light, or Dark. If a theme supports only
one mode, the mode setting is locked while that theme is selected. Choose a
theme that supports both modes to switch freely.

AMOLED is a built-in theme. It uses black surfaces in Dark mode and standard
light colors in Light mode.

## Install a theme

Open **Settings → Appearance → Install theme**. Choose one of these sources:

- **File** to select a `.fsbt` theme package.
- **URL** to install a theme package from an HTTPS link.
- **Folder** on desktop to import a theme directory, useful while developing a
  theme.

After installation, the theme is applied and appears in **Theme preset**.
Installing a theme that is already installed, such as a newer version or a
theme folder imported again after editing, replaces the earlier installation;
if that theme was in use, the new one stays selected. Other installed themes
are not affected.

## Browse the theme store

Open **Settings → Appearance → Theme store** to browse themes from the theme
catalog. A catalog theme that is already installed is shown in the same row.
Select an uninstalled theme to download and apply it. Select an installed theme
to apply it. Use the button beside a theme to install or remove it, depending
on its current state. Removing the theme in use returns the app to its default
theme.

Use the expand button on a row to preview the theme before installing it. The
preview uses the theme's colors, component styles, background and icons;
segmented controls above it switch between Light and Dark and between the
package's variants. A
theme that is not installed is downloaded for the preview and checked like an
install; nothing is installed or applied. Previews are closed by default, and
downloaded preview files are deleted when the store is closed.

For an installed package with variants, the row shows a segmented control
with one segment per variant; select a segment to apply that variant.

The store remembers its latest results between launches, so previously loaded
themes remain visible while offline. The caption below the app bar shows when
the list was last updated; each catalog theme's row shows its repository and
version. Use the refresh button in the app bar or pull down on the list to check
for updates. Descriptions are shown in the app's language when the theme
provides one. Search matches theme names, variant names, descriptions in any
language, and repository names;
the sort control can put the active theme first or sort by name.

When the store offers a different version of an installed theme, its row shows
an update button. Updating replaces the installed version; if the theme is in
use, it stays in use.

Some themes may require a newer app version. They remain visible in the store,
with an explanation when they cannot be installed.

## In the Monitor panel

The [Monitor](/docs/advanced/monitor-agent/)'s web panel uses the same
`.fsbt` packages as the App. Themes in the panel are kept on the Monitor for
your account, so they apply in every browser you sign in from, and they are
separate from the themes installed in the App.

Open **Settings → Appearance → Themes** in the panel:

- Select **Default** for the desk's own colors, or select an installed theme.
  A package with variants lists each one, such as `Pride · Trans`.
- **Install a theme → From file** uploads a `.fsbt` package. The Monitor reads
  and checks it with the same code as the App, and refuses a package that
  fails the checks.
- **Theme store** lists the themes of the ServerBox catalog. The Monitor
  downloads the package over HTTPS and checks its SHA-256 before installing it;
  the panel cannot make the Monitor download from any other address. A theme
  that needs a newer Monitor is shown but cannot be installed. A newer version
  of an installed theme shows **Update**.
- The delete button beside a theme removes it. Removing the theme in use
  returns the desk to **Default**.

A theme that supports only Dark or only Light sets the panel's appearance mode
while it is selected; a theme that supports both switches to its preferred
mode when selected. Selecting a theme with a background image makes that image
the desk's wallpaper; the wallpaper choices on the same page can replace it.
Each account can install at most 32 themes, using at most 128 MiB
in total.

## Create a theme

Theme packages are authored as a directory with a `manifest.toml` and optional
images, then shared as a `.fsbt` file or published in a theme repository. See
the [theme authoring guide](/docs/development/theme-authoring/) for the package
format and publishing instructions.

---

### Src Content Docs Advanced Troubleshooting (`docs/src/content/docs/advanced/troubleshooting.md`)

---
title: Common Issues
description: Common problems and how to resolve them
---

## Connection issues

### SSH will not connect

Typical symptoms include a timeout, a refused connection, or a login failure.

Check the following in order:

1. Confirm that SSH server software is installed and running. Supported hosts include Linux, macOS, Android/Termux, and Windows with OpenSSH Server.
2. From another terminal, try `ssh user@server -p port`.
3. Check the network route and firewall rules, then verify that the SSH port is reachable.
4. Check the username and the configured password or SSH key.
5. If you use a jump server or ProxyCommand, test that route to the target separately.

### Connections disconnect frequently

You may see the terminal disconnect while idle or shortly after the App goes into the background.

Try these steps:

1. Configure SSH keep-alive on the server in `/etc/ssh/sshd_config`:

   ```text
   ClientAliveInterval 60
   ClientAliveCountMax 3
   ```

2. On Android, enable **Background running**, allow notifications, and exempt Server Box from battery optimization. MIUI/HyperOS may also require the battery policy **No restrictions**.
3. iOS may suspend background connections. Return to Server Box and wait for it to reconnect.

## Input issues

### Some characters cannot be entered

1. Use the terminal's virtual keyboard for Esc, Tab, Ctrl/Alt combinations, and common symbols.
2. Tap **IME** to show or hide the system keyboard.
3. If a third-party keyboard sends unexpected input, switch to the system keyboard and try again.

## App issues

### The App crashes on startup or shows a black screen

An invalid value in the JSON settings editor can stop the App from starting.

1. Restore a backup made before the setting was changed.
2. Android: open **System Settings → Apps → Server Box → Storage** and clear the App data.
3. iOS: delete and reinstall the App, then restore the backup.

Clearing app data or reinstalling removes anything that was not backed up. Use these steps only if you cannot recover another way.

### Backup or restore fails

**Backup fails:**

- Check the device's available storage.
- Confirm that the App can access the selected destination.
- Try another destination.

**Restore fails:**

- Make sure the backup file is complete and has not been altered.
- Confirm that it was created by a compatible App version.
- If it contains credentials, check that the App can access the platform's secure storage needed to decrypt them.

**Sync stops on one device:**

- App versions from before the current sync format continue syncing to the legacy backup file and do not exchange changes with newer versions, without showing an error on either side.
- If a newer device writes data in a format that an older version cannot read, the older device stops importing remote changes and prompts you to update, while still uploading its own local changes.
- Keep ServerBox updated on all synced devices.
- If the backup page reports that synced data is encrypted with a different backup password, enter the password used on your other devices. Sync remains paused on this device until the password matches. All synced devices share the same password—after changing it on one device, update it on the others.

## Widget and Watch App issues

### Widgets or the Watch App do not update

- Confirm that the Monitor is running and reachable at the configured URL.
- Check the Monitor password, certificate, and `allowInsecure` setting in the App.
- iOS decides when to refresh widgets. Wait for its next refresh, or remove and add the widget again.
- On Android, tap the widget to refresh it. Open its configuration to confirm the selected server and metric.
- The Watch App must be paired with an iPhone. After changing a server, open Server Box on the iPhone and wait for it to sync.

### A widget shows an error or no servers

- Add at least one Monitor server in the App.
- Verify that the Monitor's HTTPS address is reachable and its credentials are correct.
- Widgets use the server list from the App; they no longer read manually entered `/status` URLs. If an older version left a URL behind, follow the one-time in-app prompt to configure the server again.

## Performance issues

### The App is slow

- Increase the status refresh interval.
- Check network latency and available bandwidth.
- Temporarily disable servers or status cards you do not need.
- Run fewer terminal sessions and file transfers at the same time.

### High battery usage

- Increase the status refresh interval.
- Turn off background running or refresh when it is not needed.
- Close SSH sessions you are not using.

## Getting help

If these steps do not resolve the issue:

1. Search [GitHub Issues](https://github.com/lollipopkit/flutter_server_box/issues).
2. Open an Issue with the App version, platform, relevant logs, and steps to reproduce the problem.
3. For Monitor problems, include its version and relevant configuration. Remove passwords, tokens, and other secrets first.

---

### Src Content Docs Advanced Url Scheme (`docs/src/content/docs/advanced/url-scheme.md`)

---
title: Links (serverbox://)
description: Open a server, a function, a tab or a snippet from a link
---

On iOS, macOS, and Android, `serverbox://` links open Server Box. You can use
them in Shortcuts, launchers, notes, or web pages.

Windows and Linux do not handle these links.

## Getting a link

- **Server**: long-press (or right-click) a server in the list → **Copy link**.
- **Snippet**: open the snippet → the link button in the top bar.

Servers and snippets are named by their id, not their name: names can repeat
and change.

## Links

| Link | Opens |
| --- | --- |
| `serverbox://server/<id>` | The server's page |
| `serverbox://server/<id>/<function>` | One of the server's functions |
| `serverbox://tab/<tab>` | A tab |
| `serverbox://snippet/<id>` | A snippet, on a server picked after opening |
| `serverbox://snippet/<id>?server=<id>` | A snippet, on that server |
| `serverbox://add-server?host=…&port=…&user=…&name=…` | The add-server form, filled in |

`<function>` is one of `terminal`, `files`, `container`, `process`, `snippet`,
`iperf`, `systemd`, `portForward`, `power`, `users`, `scheduledTasks`,
`remoteDesktop`, `firewall`.

`<tab>` is one of `server`, `ssh`, `file`, `snippet`, `agent`, `benchmark`,
`remoteDesktop`, `virt`, `workspace`, `monitor`.

For `add-server`, only `host` is required.

## What a link can do

Any web page or app can open a link, so a link only does what a tap in the app
does, and asks wherever the app asks:

- A snippet is always shown and confirmed before it runs.
- `add-server` only fills in the form. Nothing is saved until you save it, and
  it never takes a password or key: a link ends up in browser history and
  clipboard managers.
- Power actions ask before they run, as they do from the server's page.

When the app is locked, a link waits until it is unlocked.

---

### Src Content Docs Advanced Widgets (`docs/src/content/docs/advanced/widgets.md`)

---
title: Home Screen Widgets
description: Add server status widgets to your home screen
---

Install the [Monitor](/docs/advanced/monitor-agent/) on the server, then add
it to the App. The App passes its configured Monitor servers to the widgets.

## How widgets work

Widgets request data directly from the Monitor, so the App does not need to
be open. For each server configured with the Monitor, the App publishes its
name, address, and a short-lived read-only token. The token is stored in the
platform's secure credential storage.

Choose between two layouts: **Small** displays current readings, and
**Medium** displays charts for several metrics. During setup, select a server
and its leading metric. The widget gets its URL from the server configuration.

## iOS widgets

iOS 17 or later is required.

### Setup

1. Touch and hold the Home Screen, then tap **+**.
2. Search for “Server Box”.
3. Choose the **Small** or **Medium** widget.
4. After the widget appears, touch and hold it, then tap **Edit Widget**.
5. Select the server to display.

Each iOS widget displays one server. Small widgets show its current readings;
Medium widgets show charts for several metrics.

### Notes

- Add the server to the App with the Monitor configured.
- The App applies that server's `allowInsecure` setting. Use HTTPS unless you intentionally need plaintext HTTP for a non-loopback connection.
- iOS chooses when widgets refresh; it does not guarantee a fixed interval.
- Add multiple widgets to show different servers.

## Android widgets

### Setup

1. Long-press the Home Screen and tap **Widgets**.
2. Find “Server Box”, choose the Small or Medium type, and add it.
3. On the configuration page, select a server and leading metric.
4. Tap Save.
5. Tap the widget to refresh it manually when needed.

Every Android widget instance keeps its own server and metric selection, so
widgets can show different information. The App supplies the server list. If
it is empty, add a server configured with the Monitor first.

## Watch app

The Watch app requires watchOS 10 or later and reads data directly from
the Monitor. It can show only servers configured with the Monitor in the
App. Those servers sync by default. To exclude one, open **iOS Settings → App
→ iOS → Watch app**.

### Setup

1. Open Server Box on the iPhone.
2. Open **Settings → Application → iOS → Watch app**.
3. Exclude any servers you do not want on the Watch; the remaining Monitor servers will sync.
4. Wait for synchronization to finish.

The Watch app sorts its server pages by name, regardless of the order in the
App. To add a **Lock screen widget**, use the system widget gallery and select
a server there; it has no separate setting in Server Box.

## Troubleshooting

### Widgets or the Watch app do not update

- Make sure the Monitor is running and reachable at the configured address.
- Check the Monitor password, certificate, and `allowInsecure` setting in the App.
- iOS controls the refresh schedule. Wait for another refresh, or remove and add the widget again.
- Tap an Android widget to refresh it. Open its configuration to confirm the selected server and metric.
- Pair the Watch with an iPhone. After changing server settings, open Server Box on the iPhone and wait for sync.

### A widget shows an error or no servers

- Add at least one Monitor server in the App.
- Check the Monitor's HTTPS configuration, saved credentials, and network reachability.
- Widgets use the App's server list instead of manually entered `/status` URLs. If a one-time migration prompt appears, follow it to configure the server again.

## Security

- Prefer HTTPS.
- To use plaintext HTTP with a non-loopback address, enable **Allow insecure HTTP** for that server in the App. Widget endpoints (`/api/v1/metrics`, `/api/v1/metrics/history`, and `/api/v1/watch-token`) have no Monitor-side switch. The Monitor's `allow_insecure` options apply to `[remote_access.terminal]` and `[remote_access.fs]` only.
- Keep Monitor credentials and widget tokens out of public documentation and version control.

---

### Src Content Docs Advanced Workspace (`docs/src/content/docs/advanced/workspace.md`)

---
title: Workspace
description: Several views of several servers side by side, with keyboard shortcuts
---

The **Workspace** tab arranges server views in panes. For example, put a
server's terminal beside its status page, or show one server's shell above
another server's containers. Each pane can show a view available from a
server's detail page.

The tab is hidden by default. Open it from **More**, or add it under
**Settings › Application › Home Tabs**.

## Workspaces, panes and tabs

- A **workspace** is a named arrangement. You can keep several and switch
  between them from the name at the top left.
- A workspace is split into **panes**. Split a pane right or down, drag the
  line between two panes to resize them, and double-click that line to make
  the two halves equal again.
- Each pane holds **tabs**. A tab is one view of one server: terminal, status,
  files, Agent, containers, processes, services or snippets.

Drag a tab to another pane's edge to split that pane, or to its middle to add
it there. On iOS and Android, press and hold a tab before dragging. If the
pane is on a phone or too narrow to show its tabs, drag the pane bar instead.

A narrow window shows the focused pane and the one you focused just before it.
The panes button at the top lists every pane and moves the focus.

**Maximize** fills the workspace with one pane and hides the others until you
restore it. Double-clicking a pane's strip of tabs does the same. A narrow
window has no maximize: it already shows at most two panes.

You can undo the most recent tab or pane close from the message that appears,
or use the **Reopen closed tab** shortcut. Reopening restores the workspace to
the state before that close, so it also discards any layout changes made since.
You cannot undo the close after closing that workspace or deleting a server used in it.

## After a restart

Workspaces are kept on the device. When the app starts again, tabs of a
server set to connect at launch reconnect as they are shown. Tabs of any other
server wait until you tap **Connect**, or until the server is connected from
the server tab; either connects all of that server's tabs. A tab on a server
that has been deleted is removed.

## Sync input

**Sync input** sends each key you type to every other terminal in the
workspace, like tmux `synchronize-panes`. A bar above each terminal shows when
it is enabled. Terminal-generated replies, such as cursor-position reports,
are not copied.

## Templates

**Save layout as template** stores the pane layout and each pane's view types,
without server assignments. Choosing a template creates a workspace with
that layout. Its tabs use the server assigned to the active tab in the focused
pane; if that pane is empty, you choose a server.

## Moving a terminal into a workspace

In the **Terminal** tab, **Move to workspace** moves the current server
terminal into a workspace. This option is not available for a terminal on
this device. The connection, shell, and screen contents are preserved.

## Keyboard shortcuts

**Settings › Application › Keyboard shortcuts** lists the app's shortcuts.
You can change or remove configurable shortcuts; fixed shortcuts are listed
but cannot be changed. Workspace shortcuts work only in a workspace. Global
shortcuts, such as opening Settings, work on every page. In a terminal outside
a workspace, shortcuts assigned to workspace, Settings, or server-tab actions
are sent to the shell because those actions are unavailable there. The
terminal's copy, paste, and select-all controls are not configurable shortcuts.

| Command | Windows / Linux | macOS |
| --- | --- | --- |
| Quick open | `Ctrl+Alt+P` | `⌃⌘P` |
| Split right | `Ctrl+Alt+\` | `⌃⌘\` |
| Split down | `Ctrl+Alt+-` | `⌃⌘-` |
| Move focus between panes | `Ctrl+Alt+←↑→↓` | `⌃⌘←↑→↓` |
| New tab | `Ctrl+Alt+N` | `⌃⌘N` |
| Close tab | `Ctrl+Alt+W` | `⌃⌘W` |
| Next / previous tab | `Ctrl+Alt+]` / `Ctrl+Alt+[` | `⌃⌘]` / `⌃⌘[` |
| Tabs of the focused pane | `Ctrl+Alt+O` | `⌃⌘O` |
| Reopen closed tab | `Ctrl+Alt+Shift+T` | `⌃⌘⇧T` |
| Maximize or restore pane | `Ctrl+Alt+M` | `⌃⌘M` |
| Sync input | `Ctrl+Alt+I` | `⌃⌘I` |
| Switch workspace | `Ctrl+Alt+S` | `⌃⌘S` |

On Windows and Linux, combinations with Control and Alt are taken from the left
Alt key only. The right Alt key (AltGr) types characters such as `\` and `[`
on many keyboard layouts, so it is left to the shell.

---

### Src Content Docs Development Architecture (`docs/src/content/docs/development/architecture.md`)

---
title: Implementation Architecture
description: Implementation details for Server Box's Flutter, storage, connection, and native layers
---

Use this page to find where features live in the source tree.

## Layers

```text
┌─────────────────────────────────────┐
│ Presentation                        │
│ lib/view/                           │
│ Pages, Widgets, and user interaction│
└─────────────────────────────────────┘
                  │
┌─────────────────────────────────────┐
│ State and business coordination     │
│ lib/data/provider/                  │
│ Riverpod providers and async state  │
└─────────────────────────────────────┘
                  │
┌─────────────────────────────────────┐
│ Data and services                   │
│ lib/data/model/, lib/data/store/    │
│ Models, storage, and connections    │
└─────────────────────────────────────┘
                  │
┌─────────────────────────────────────┐
│ External integrations               │
│ SSH, SFTP, Monitor HTTP, platform APIs│
└─────────────────────────────────────┘
```

## Application foundation

`lib/main.dart` initializes dependencies, opens the encrypted local database,
initializes Rust bindings, and starts Flutter with `runApp`. The root Widget
sets up the theme and routes and creates the Riverpod `ProviderScope` used for
dependency injection.

The home page provides tabs for servers, terminals, files, and snippets. Pages
render state and handle interaction. Providers, services, and stores perform
operations and manage state changes.

## State management: Riverpod

The project uses `riverpod_generator` to generate typed providers:

- `NotifierProvider` manages synchronous state with update methods.
- `AsyncNotifierProvider` manages loading, success, and error states.
- `StreamProvider` exposes continuously produced data.
- Family providers maintain independent state for different servers or other parameters.

Providers do not require `BuildContext`. This keeps services and business
logic independent of the Widget tree. See [Riverpod patterns](/docs/development/state/)
for provider declarations and lifecycle details.

## Data persistence: encrypted SQLite

The encrypted SQLite file `store.db` is the App's source of truth for local
data. `SqliteDb` opens it, configures database encryption, and enables the
`foreign_keys` pragma.

Data uses one of two shapes:

- **Key-value table `kv(store, key, value, updated_at)`** holds settings and
  history that do not need relational queries. Values are JSON; values written
  through `SqliteStore.set` must provide `toJson`.
- **Entity tables** hold servers, private keys, snippets, port forwards,
  connection statistics, Agent conversations, and related records. They use
  columns, foreign keys, constraints, and indexes.

Drift defines the DDL in `lib/data/store/db.dart`. `SqliteDb` manages the
connection, and store queries remain hand-written and synchronous. Entity
primary keys are generated IDs; user-provided names are ordinary columns with
unique constraints. Lists and maps are stored in child tables.

## Dependency injection

Services and stores receive dependencies through three patterns:

1. **Providers**: expose dependencies and state to the UI.
2. **GetIt**: provide global service instances where service location is appropriate.
3. **Constructor injection**: pass dependencies explicitly between classes.

## Platform and Rust integration

Flutter supplies the cross-platform UI. Platform integrations provide
notifications, background services, filesystem access, and other operating
system features. The App exposes Rust APIs to Dart through `crates/sbm_ffi`
and flutter_rust_bridge; generated bindings are in `lib/src/rust/`.

`crates/sbm_parser` contains parsing logic shared by the projects.
`crates/sbm_native` collects metrics for the Monitor on the machine running
the Monitor. The App does not invoke `sbm_native` on remote servers.

---

### Src Content Docs Development Building (`docs/src/content/docs/development/building.md`)

---
title: Building
description: Build Server Box and Monitor for different platforms
---

Build the Flutter App with the repository's `fl_build` tool. The Monitor
is a separate Rust service and has its own build steps.

## Prerequisites

- Flutter SDK on the stable channel
- Platform SDKs: Xcode for iOS, Android Studio and Android SDK for Android, or Visual Studio for Windows
- Rust toolchain: the App builds `crates/sbm_ffi` using a Dart build hook, `flutter_rust_bridge_hooks`, and native assets

Initialize the Git submodules before fetching Dart packages:

```bash
git submodule update --init --recursive
```

## Run a development build

```bash
# Run on the default device
flutter run

# Select a device explicitly
flutter run -d <device-id>
```

## Release build

Pass the target platform to `fl_build`:

```bash
dart run fl_build -p <platform>
```

Supported platform names are `ios`, `android`, `macos`, `linux`, and
`windows`.

## Platform requirements

### iOS

```bash
dart run fl_build -p ios
```

Builds require macOS and Xcode. Signing also requires an Apple Developer
account.

### Android

```bash
make build-android
```

Requires the Android SDK, a JDK, and the 1Password CLI: release builds are
signed with the key that `scripts/release/android-signing.sh` reads from
1Password. For local
verification only, pass `-PallowDebugReleaseSigning=true` explicitly to use
debug signing. Reproducible and F-Droid builds use
`-PallowUnsignedRelease=true`, which omits signing configuration;
`scripts/release/android-build-env.sh` exports this option.

### macOS

```bash
dart run fl_build -p macos
```

### Linux

```bash
dart run fl_build -p linux
```

### Windows

```bash
dart run fl_build -p windows
```

Requires Visual Studio with the **Desktop development with C++** workload and
ATL support.

## Build the Monitor

The Monitor is a standalone server binary. Build it separately from the
Flutter App:

```bash
# From the repository root
cargo build --release

# Build the web panel
cd monitor/frontend
npm install
npm run build
```

After building the panel, Monitor serves it when `frontend/dist` exists.
For development, run `make monitor-dev` from the repository root. It starts
the API on `:3770` and the Vite dev server on `:3000`.

The `monitor-release.yml` workflow builds release artifacts and currently
runs only through `workflow_dispatch`. Monitor `monitor-v*` tags are separate
from App releases. For a Docker build, see `monitor/Dockerfile`.

## Build hooks

On every build, `fl_build` regenerates `lib/data/res/build_data.dart`, derives
the build number from Git history, and writes the version to the Xcode
configuration. Set the App name in the `fl_build:` section of `pubspec.yaml`.

## Troubleshooting

### Clean build

```bash
flutter clean
flutter pub get
dart run build_runner build
```

The iOS Linux engine's libraries live in `packages/fl_tty/build/iul`, outside
what `flutter clean` removes, and fl_tty's build hook fetches them again when
they are missing.

### Dependency version conflict

Check package compatibility before upgrading dependencies:

```bash
flutter pub upgrade
```

After changing an annotated model, run code generation as well; see [Code Generation](/docs/development/codegen/).

## Release checklist

1. Update the version in `pubspec.yaml`.
2. Run code generation and localization generation.
3. Run Dart, Flutter, and Rust tests.
4. Build every target platform.
5. Verify key features on real devices.
6. Create the GitHub release.

---

### Src Content Docs Development Codegen (`docs/src/content/docs/development/codegen.md`)

---
title: Code Generation
description: Generate Dart, Flutter, and Rust binding code
---

The project generates immutable model code, JSON serializers, Riverpod
providers, localization code, and Rust bindings. Run the
generator that matches the source you changed.

## When to run code generation

Run code generation after changing any of these inputs:

- Models with `@freezed`
- Classes with `@JsonSerializable`
- Providers with `@riverpod`
- ARB localization files
- Rust APIs under `crates/sbm_ffi/src/api`

## Dart generation

### Normal generation

```bash
dart run build_runner build
```

### Clean and regenerate

Use a clean build when the cached asset graph is out of sync with the source
tree, for example after merging generated source files. A stale
`.dart_tool/build/asset_graph.json` can cause build_runner to stall midway
through a phase without reporting a useful error.

```bash
dart run build_runner clean
dart run build_runner build
```

## Generated files

### Freezed (`*.freezed.dart`)

Freezed produces immutable model implementations, `copyWith`, equality, and
union APIs:

```dart
@freezed
class ServerState with _$ServerState {
  const factory ServerState.connected() = Connected;
  const factory ServerState.disconnected() = Disconnected;
  const factory ServerState.error(String message) = Error;
}
```

### JSON serialization (`*.g.dart`)

`json_serializable` creates `fromJson` and `toJson` methods based on model
fields:

```dart
@JsonSerializable()
class Server {
  final String id;
  final String name;
  final String host;

  Server({required this.id, required this.name, required this.host});

  factory Server.fromJson(Map<String, dynamic> json) =>
      _$ServerFromJson(json);
  Map<String, dynamic> toJson() => _$ServerToJson(this);
}
```

### Riverpod providers (`*.g.dart`)

`riverpod_generator` creates provider declarations from `@riverpod` classes:

```dart
@riverpod
class MyNotifier extends _$MyNotifier {
  @override
  int build() => 0;
}
```

### Hive readers

Nothing generates a Hive adapter, and no model carries a Hive annotation. The
readers in `lib/hive/` (`legacy_adapters.dart`, `frozen_adapters.dart`,
`spi_legacy_adapter.dart`) are hand-written and frozen: each reads the bytes a
released build wrote. Old boxes do not contain fields added since, so a reader
built from a current model can make an old box unreadable. Change one only when
data written by a released version requires it, and update its migration test
at the same time.

## Rust bindings (flutter_rust_bridge)

After editing a Rust API under `crates/sbm_ffi/src/api`, regenerate its Dart
bindings:

```bash
flutter_rust_bridge_codegen generate
```

The generator reads `flutter_rust_bridge.yaml` and writes files to
`lib/src/rust/`. Do not edit those generated files. Do not run
`flutter_rust_bridge_codegen integrate`; its template scaffolding does not
match this repository.

## Localization generation

After editing a localization file in `lib/l10n/*.arb`, run:

```bash
flutter gen-l10n
```

Generated localization code is written to `lib/generated/l10n/`.

## Notes

- build_runner 2.15 removed `--delete-conflicting-outputs`; it now prints a warning and has no effect. Clear the cache as described above instead.
- Include generated files in your change when this repository tracks them.
- Do not edit `*.g.dart`, `*.freezed.dart`, or files under `lib/generated/` by hand.
- After changing a model, complete generation before running analysis and tests.

---

### Src Content Docs Development Desk App Reference (`docs/src/content/docs/development/desk-app-reference.md`)

---
title: Desk App Reference
description: The contract between a desk app and the Monitor panel's desk — sandbox, manifest, lifecycle, bridge protocol, UI, permissions, packages and the wasm backend
---

This page is the contract a third-party desk app is built against. For a
walkthrough from the template to an installed package, see
[Developing Desk Apps](/docs/development/desk-apps/). The client library,
`serverbox-desk`, implements the protocol below; `protocol.ts` in it is the one
copy of the message shapes.

## App kinds and the sandbox

| Kind | Code | Runs in | Reaches |
|---|---|---|---|
| `web` | A static bundle (HTML, JavaScript, CSS) installed on the Monitor | A sandboxed iframe | The desk only, over a message bridge. No Monitor API, no network |
| `wasm` | A `web` bundle plus a WebAssembly component (API 2) | Frontend: a sandboxed iframe. Backend: the Monitor's wasmtime runtime | The desk, and its own backend's service through `call` and `job`. The backend reaches the machine only through the host functions its permissions allow |

A third-party app never runs in the panel's own page: code there could read the
session token and act as the signed-in account. The frame is
`sandbox="allow-scripts"` without `allow-same-origin`, so it runs in an opaque
origin. The Monitor serves an installed bundle with
`Content-Security-Policy: sandbox allow-scripts allow-forms; default-src 'self'; connect-src 'none'`,
so the bundle stays sandboxed even when it is opened directly.

The sandbox does not stop an app from sending out what it has read:
`connect-src 'none'` blocks its requests, but a frame can navigate itself to
any URL, and WebRTC is outside `connect-src` in Chromium. The bridge is
therefore reached only over a `MessagePort` the desk hands the frame's first
page; when the frame loads another page, the desk closes the bridge and removes
the frame, so a page the app navigates to never acts as the app. **An approved
app is trusted with whatever its permissions let it read**, and the approval
dialog says so.

## Manifest

`manifest.json` in the package.

| Field | Meaning |
|---|---|
| `publisher`, `name` | Each `[a-z][a-z0-9_]`, at most 24 characters (a publisher at least 2). The app's id is `<publisher>.<name>`, made from them and never written. It is stable: windows, the dock, icons and the app's storage are kept by it. The panel's own apps use `serverbox`, which no package can take without its signature |
| `api` | The desk API version the app was built for; the desk refuses a newer major |
| `kind` | `web` or `wasm` |
| `title`, `keywords` | Shown in the dock, Apps, Spotlight and the menubar. A string, or translations keyed by locale |
| `description` | What the app does, on its App Store page (at most 600 characters). A string, or translations keyed by locale |
| `glyph`, `tone` | The app icon: a Material Symbols Rounded name and a tone of the desk's design system |
| `instances` | How many windows may be open (default 1) |
| `size`, `min_size` | The first window's size and the smallest allowed |
| `permissions` | See [Permissions](#permissions) |
| `opens` | File types the app can open (`{ "ext": ["log", "txt"], "dirs": false }`, `"*"` for any); Files offers the app under **Open with** |
| `os` | Optional: `linux`, `macos`, `windows`, or a distribution's `/etc/os-release` `ID`. The catalog offers the package only on those systems |

## Windows and lifecycle

A window is one process of its app, with its own state and lifecycle. Closing
the window ends the process.

| State | When | What the app does | What the desk does |
|---|---|---|---|
| `active` | The front window | Everything | The menubar shows the app's menus; its shortcuts are live |
| `visible` | On screen, not in front | Everything | — |
| `background` | Minimised, the desk locked, or the browser tab hidden | Stops drawing (animation, charts, polling for display); keeps the sessions it needs | The window's content is not rendered; the frame stays |
| `suspended` | `background` while background running is off | — | Removes the content after 5 seconds: sockets and timers end. The window remains; when it comes back the app starts again and restores itself from `appState` |

Background running is on by default. The owner can turn it off for the desk, or
for one app, under **Settings → Apps**; a third-party app also needs the
`background` permission. `keepAlive(reason)` holds a `background` app off
suspension until released, at most 10 minutes (an upload in progress).
Control Centre lists the apps running in the background.

An app saves what it needs to come back with (`setAppState`, at most 16 KiB of
JSON, never secrets) whenever it changes, not on suspension: a frozen browser
tab may be suspended with no code running.

## The bridge

The desk posts `{ sbm: 1, event: 'connect' }` with a `MessagePort` to the
frame's first page. The frame posts calls `{ sbm: 1, id, call, args }` on that
port and gets `{ sbm: 1, re, ok, value | error, message? }` (`message`: a
backend's own words). The desk sends events `{ sbm: 1, event, data }`, held
until the frame's `hello`. Only the port is heard, and every shape and size is
checked: 1 MiB per message, 32 calls in flight, `appState` at most 16 KiB,
three `open` calls per 10 seconds.

| Call | Does |
|---|---|
| `hello` | Answers the app and window id, `appState`, the lifecycle state, theme, locale, the granted permissions and `ui.stylesheet` |
| `setTitle`, `setAppName`, `setIcon`, `setBadge`, `setAppState`, `close` | The window's title, the app's name, icon (`{ glyph, tone }`) and badge, its saved state, closing it |
| `toolbar` `{ title, subtitle, actions }`, `menus` `{ menus }` | Described by the app, drawn by the desk; using one sends `action { id }`. Menu entries may carry a `shortcut` (`⌘⇧N`), live while the window is in front; the desk's own shortcuts come first |
| `sidebar` `{ sections: [{ title?, items: [{ id, label, icon?, trailing? }] }], selected? }` | The window's inset sidebar (folded in a narrow window); choosing an item sends `navigate { id }`. No sections, no sidebar |
| `notify` `{ title, body, level }` | A banner (unless Do Not Disturb) and a row in the notification centre; clicking it brings the window forward. Needs `notifications` |
| `storage.get`, `storage.set`, `storage.remove`, `storage.keys` | The app's own storage: JSON by key, per app and server. 256 KiB per app and 4 MiB across apps; keys at most 128 bytes |
| `open` `{ appId, newWindow, intent }` | Opens another app. The only intent an app may hand on is `open` of a path |
| `handlers` `{ path, kind }` | The apps that can open a path |
| `keepAlive`, `release` `{ token, reason }` | See [Windows and lifecycle](#windows-and-lifecycle). Needs `background` |
| `backend.call`, `backend.job` `{ function, args, sudo? }` | Its backend's `api` function (`{ value }`) or one of its `jobs` (the job's view). With `sudo` (`{ title, body, confirmWord? }`, plain text, bounded) the desk first shows its own dialog naming the app; sudo's password goes from the desk to the Monitor with that request, never to the frame. Closing the dialog answers `declined` |
| `backend.jobView` `{ since }`, `backend.cancel` | The app's running or last job (lines from `since`, then `value` or `error`), and asking it to stop |
| `openUrl` `{ url }` | An http(s) page in a tab of its own (the frame has no popups); counted with `open` |
| `power` `{ action }` | The desk's own restart and shut-down dialog, which the user confirms there. Needs `root`; counted with `open` |
| `openStack` `{ id, model?, backend? }` | The desk's own page for a model server stack (`ollama.ollama`, `ggml.llama_cpp`, `vllm.vllm`, `sglang.sglang`) in a sheet over the window, set up with the model and backend when it is not deployed; the user confirms there with the password. Answers once the sheet is closed. Needs `process`; one at a time |

Events: `lifecycle`, `theme`, `locale`, `intent` (`{ action, data, from }`),
`action`, `navigate`. An intent carries `from`, set by the desk: act on one only
from the apps you expect.

## UI

An installed app is drawn with the desk's design system without carrying any of
it. What an app gets is an interface — classes and tokens — never the code; the
classes and tokens are kept stable for apps, and a rename keeps the old name
working for a release.

- **Delivery.** The Monitor serves the design system's stylesheet and fonts at
  `/desk-app/` (one URL for every app, open to any origin, the fonts immutable).
  `hello` passes the stylesheet's address on as `ui.stylesheet`.
- **`connect()`** in `serverbox-desk` puts the sheet first in `<head>` (the
  app's own styles win) and waits for it (at most 5 seconds), gives `<body>`
  the `lk` class the system is scoped to, sets the mode on `<html>`
  (`data-theme`), and sets the installed theme's tokens on `<body>`, again on
  every `theme` event. `connect({ style: false })` leaves the page alone.
- **Classes**: buttons (`lk-btn` with `--primary`, `--secondary`, `--tinted`,
  `--ghost`, `--destructive`, `--sm`, `--lg`, `--block`), icon buttons
  (`lk-iconbtn`), fields (`lk-input`, `lk-select`, `lk-field`), checkbox and
  radio (`lk-check`, `--radio`, `--on`), switches (`lk-switch`, `--on`),
  segmented controls (`lk-seg`), cards (`lk-card`, `--raised`, `--glass`,
  `--interactive`, `--selected`), badges (`lk-badge` with a tone), settings
  groups (`lk-setgroup`, `lk-setrow`), tables (`lk-table`, `lk-table__row`,
  `--sel`), tooltips (`lk-tip`), stat tiles (`lk-stat`), status bars
  (`lk-statusbar`), the text helpers `lk-caps`, `lk-mono`, `lk-num`, and icons:
  `<span class="lk-icon" data-icon="folder">` (Material Symbols Rounded names;
  `lk-icon--fill`).
- **Tokens**: `--color-*`, `--surface-*`, `--text-*`, `--border-*`, `--fill-*`,
  `--space-*`, `--radius-*`, `--shadow-*`, `--font-*`, `--dur-*` and `--ease-*`.
  A theme changes token values, never names.

## Permissions

A manifest lists what the app needs. The Monitor decides on every call: what an
app may do is bounded by its approved permissions and by the transport rule
(acting needs TLS or a loopback caller, see
[Monitor API and Access Model](/docs/development/monitor-agent/#transport)).
Within them it reaches what the Monitor's system account can, except the
Monitor's own state.

| Permission | Allows | Transport rule |
|---|---|---|
| `notifications` | `notify` | — |
| `background` | Background running and `keepAlive` | — |
| `status` | The backend's read of the status sample | — |
| `process` | The backend's `exec` and a job's `run`: a script as the Monitor's account | yes |
| `root` | The backend's `exec-root` and a job's `run-root`: a script as root, with the sudo password the desk asked for that call or job | yes |
| `providers` | The backend's `providers` and `endpoint`: Agent mode's providers with an address on this machine, each one's key included | yes |
| `network` | The backend's `http`: requests from the Monitor (loopback directly, the rest through its proxy settings; no redirect followed) and downloads checked by their SHA-256 into the app's folder | yes |

The owner installs an app and approves it under **Settings → Apps**. An
approval names the package (its SHA-256) and asks for the Monitor's password
again; an upload asks for none, so **any new package, whatever its version or
permissions, waits for approval again**. Removing an app removes what it kept
in its storage.

## Packages

A package is a `.fsba` file (a gzipped tar): `manifest.json`, `ui/` (the
bundle, with `ui/index.html` as the entry), `backend.wasm` (`wasm` only),
`LICENSE`. A `web` package takes API 1 or 2, a `wasm` package API 2. The
Monitor checks the manifest, the sizes (bundle 20 MiB, backend 20 MiB) and the
paths (no `..`, no links), and refuses a backend it cannot compile
(`invalidBackend`) or an API 1 core module (`unsupportedApi`).

- **Signatures.** `SIGNATURE` (`{ key, signature }`) is an ed25519 signature
  over the SHA-256 of the package's listing: `<sha256>  <path>` for every
  other file, sorted, as `sha256sum` writes it. A package signed with an
  unknown key, or not signed, installs as from an unknown publisher; a
  signature that does not verify refuses the package (`badSignature`). Once a
  signed app is installed, it is replaced only by a package signed with the
  same key (`publisherChanged`). Only ServerBox's own key may use the
  `serverbox` publisher.
- **Catalog.** The App Store lists packages from the store's repositories
  beside the web apps. Installing one from there installs and approves it in
  one step with the password; a package uploaded by hand waits for approval.

## The backend (`wasm`)

- `backend.wasm` is a WebAssembly **component** (WASI 0.2, `wasm32-wasip2`)
  of a world that includes `sbm:app/imports` (`monitor/wit/app.wit` in the
  repository) and exports the app's service: `api` (unary calls) and, when it
  has any, `jobs`. Every function returns `result<T, error>`, `error` being
  gRPC's canonical codes (`invalid-argument`, `not-found`, `already-exists`,
  `permission-denied`, `failed-precondition`, `unavailable`,
  `deadline-exceeded`, `cancelled`, `internal`).
- The app's own WIT is its typed contract. The frame names a function and
  passes its parameters as one JSON object: camelCase names, a `variant` as
  `{ tag, val }`, an `option` as `null`, a `result` as `{ ok }` or `{ err }`.
  Resources, streams and nested options are refused at install.
- The Monitor runs it with wasmtime: compiled once per package, a fresh
  instance per call or job (what lasts goes through `kv`), with no preopened
  directories, environment, arguments or network.
- **Host functions**: `log`; `kv-get`, `kv-set`, `kv-remove` (the app's
  storage, JSON texts); `home`; `data-dir` (the app's own folder, `0700`, never
  served by the file API, removed with the app); `status` (`status`); `exec`
  (`process`, within the Monitor's command limits); `exec-root` (`root`, with
  the request's sudo password, else `permission-denied("sudo")`);
  `holds-state`, `stack-leftovers`, `web-apps`, `shared-dir`, `stacks` and
  `models-changed` (what the Monitor knows of its own state and its web apps;
  for an app granted `process` or `root`, another is told nothing);
  `http.fetch`, `http.fetch-lines` (the body as it comes) and `http.download`
  (`network`); `providers` and `endpoint` (`providers`). In a job: `line` (its
  log), `run` (as the account, its output streamed to the log), `run-root` (as
  root) and `private-file` (a secret in a `0600` file removed when the job
  ends, so a script reads it by path and no log, argument or audit holds it).
  A permission is checked with the transport rule when the function runs.
- **Limits**: 64 MiB of memory; a trap after 10 seconds of the guest's own CPU
  time (time in host calls is not counted); a call ends after 60 seconds; at
  most 8 calls at once (`429`). A trap answers `422 { error: "trap" }`.
- **Calls and jobs**: `POST /apps/{id}/call` and `POST /apps/{id}/jobs` take
  `{ function, args, sudo? }` (`sudo`: `{ password, remember }`, tried first:
  `403 sudo_rejected`; `remember` keeps it in memory for 15 minutes). A job runs
  alone per app (`409`) until it returns or `POST /apps/{id}/jobs/cancel`;
  `GET /apps/{id}/jobs?since=` reads it. Root work and every job are audited
  with the app.

The examples in the repository are `monitor/examples/desk-app-hello` (`web`)
and `monitor/examples/desk-app-uptime` (`wasm`, a Rust component).

---

### Src Content Docs Development Desk Apps (`docs/src/content/docs/development/desk-apps.md`)

---
title: Developing Desk Apps
description: Build third-party apps for the Monitor panel's desk with serverbox-desk
---

A desk app is a static web bundle that the Monitor panel runs in a window,
inside a sandboxed frame. It is packaged as a `.fsba` file, which the
Monitor's owner installs and approves (see [Desk Apps](/docs/advanced/monitor-desk-apps/)).
The full contract, including the message protocol, is the
[Desk App Reference](/docs/development/desk-app-reference/).

| Kind | What it contains | What it can reach |
|---|---|---|
| `web` | A static bundle (HTML, JavaScript, CSS) | The desk, through `serverbox-desk` |
| `wasm` | A `web` bundle and `backend.wasm`, a WebAssembly component the Monitor runs | The desk, and its backend's service through `desk.call()` and `desk.job()` |

## Start from the template

The template in
[`monitor/sdk/template`](https://github.com/lollipopkit/flutter_server_box/tree/main/monitor/sdk/template)
uses vite and the [`serverbox-desk`](https://www.npmjs.com/package/serverbox-desk)
package (Apache-2.0, so an app built on it keeps its own license, closed source
included). Copy the directory, then point the dependency at the published
package:

```sh
npm install serverbox-desk
npm run pack   # builds dist/ and writes <publisher>.<name>.fsba
```

Inside this repository the template depends on `file:../serverbox-desk`, which
needs `npm run build --prefix ../serverbox-desk` once.

The bundle runs with no network access: everything it needs must be inside the
package, and its URLs must be relative (`base: './'` in vite).

## Talk to the desk

```ts
import { connect } from 'serverbox-desk'

const desk = await connect()
await desk.toolbar({ actions: [{ id: 'refresh', label: 'Refresh', icon: 'refresh' }] })
desk.on('action', ({ id }) => {
  if (id === 'refresh') void load()
})
const count = (await desk.storage.get<number>('count')) ?? 0
await desk.storage.set('count', count + 1)
```

`connect()` resolves once the desk has handed the frame its channel. The
returned object offers:

| Area | Calls |
|---|---|
| Window | `setTitle`, `setAppName`, `setIcon`, `setBadge`, `setAppState` (JSON up to 16 KiB that the window comes back with; never secrets), `close` |
| Chrome | `toolbar({ title, subtitle, actions })`, `menus([...])`; the desk draws them and sends an `action` event when one is used |
| Notifications | `notify({ title, body, level })`, with the `notifications` permission |
| Storage | `storage.get/set/remove/keys`: JSON per app, kept on the Monitor (256 KiB per app) |
| Other apps | `open(appId, { path })` opens another app, optionally with a file or folder; `handlers(path, kind)` lists the apps that can open it |
| Background | `keepAlive(reason)`, with the `background` permission |
| Backend | `call(fn, args, { sudo })`, `job(fn, args, { sudo, onLine })`, `jobView`, `follow`, `cancelJob`; `wasm` apps only |
| Links and power | `openUrl(url)` opens an http(s) page in a tab (a link in the frame cannot); `power('reboot')` shows the desk's own restart dialog, with the `root` permission |
| Words and numbers | `translator(dictionaries, locale)` (the panel's `{value}` and `{{one\|other}}` syntax), `formatBytes`, `formatTime` |

Events (`desk.on`): `lifecycle` (`active`, `visible`, `background`,
`suspended`), `theme`, `locale`, `intent`, `action`. `desk.info` holds what the
desk answered when connecting: the app and window ids, the saved `appState`,
the locale and the granted permissions. A refused call throws `DeskError`.

## Look like the desk

`connect()` loads the desk's stylesheet into the page, keeps the page in the
desk's light or dark mode, and applies the tokens of the theme the desk
uses. Build the UI with its classes and tokens instead of your own colors:

```html
<div class="lk-card">
  <button class="lk-btn lk-btn--primary">
    <span class="lk-icon" data-icon="play_arrow"></span>Run
  </button>
</div>
```

Buttons (`lk-btn` with `--primary`, `--secondary`, `--tinted`, `--ghost`,
`--destructive`), icon buttons (`lk-iconbtn`), fields (`lk-input`,
`lk-select`), switches (`lk-switch`), cards (`lk-card`), badges, tables
(`lk-table`), settings groups (`lk-setgroup`, `lk-setrow`) and icons
(`lk-icon` with a Material Symbols Rounded name) are listed in the
[UI section of the reference](/docs/development/desk-app-reference/#ui).
The stylesheet is served by the Monitor and is not in the package, so the app
looks right only inside the panel. `connect({ style: false })` leaves the page
alone.

## Manifest

`manifest.json` sits at the root of the package. The Monitor refuses unknown
fields.

```json
{
  "publisher": "acme",
  "name": "notes",
  "version": "1.0.0",
  "api": 1,
  "kind": "web",
  "title": { "en": "Notes", "zh-CN": "笔记" },
  "glyph": "sticky_note_2",
  "tone": "amber",
  "permissions": ["notifications"],
  "size": { "width": 640, "height": 440 }
}
```

| Field | Meaning |
|---|---|
| `publisher`, `name` | Each `[a-z][a-z0-9_]*`, at most 24 characters, a publisher at least 2. The app's id is `<publisher>.<name>`; the panel's own `serverbox` publisher is refused |
| `version` | Up to 32 characters |
| `api` | `2` (`1` is still accepted for `web`) |
| `kind` | `web` or `wasm` |
| `title` | A string, or translations by locale with `en` required; up to 64 characters |
| `glyph` | A Material Symbols Rounded name, such as `sticky_note_2` |
| `tone` | `berry`, `soft`, `ink`, `sky`, `teal`, `violet`, `amber`, `leaf`, `pale`, `bright` or `mist` |
| `permissions` | See [Permissions](/docs/advanced/monitor-desk-apps/#permissions). A `web` app may ask for `notifications` and `background`; a `wasm` app also for `status`, `process` and `root` |
| `instances` | How many windows may be open, 1 to 8 (default 1) |
| `size`, `min_size` | `{ "width", "height" }`: the first window's size and the smallest allowed |
| `opens` | `{ "ext": ["md", "txt"], "dirs": false }`: the files (`"*"` for any) and whether folders the app offers to open in Files' "Open with" |
| `keywords` | Extra words Spotlight matches |
| `os` | The systems the app is for, by `/etc/os-release`'s `ID` (`["ubuntu"]`); the Monitor's catalog offers it only there. Any when absent |

## Package

A `.fsba` is a gzipped tar of `manifest.json`, `ui/` (the bundle, with
`ui/index.html` as the entry), `backend.wasm` (present exactly when the kind is
`wasm`), and optionally `LICENSE`, `NOTICE`, `README.md` and `SIGNATURE`; nothing else is
accepted. ServerBox signs its own packages; one without a signature the Monitor knows is
shown as from an unknown publisher. The Monitor accepts regular files only, with plain relative paths,
at most 2000 files and 20 MiB compressed and unpacked. On macOS set
`COPYFILE_DISABLE=1` for `tar`, or it adds `._` files that the Monitor refuses;
the template's `npm run pack` does this.

## A backend (`wasm`)

`backend.wasm` is a WebAssembly component (`wasm32-wasip2`). Its world
includes `sbm:app/imports`
([`monitor/wit/app.wit`](https://github.com/lollipopkit/flutter_server_box/blob/main/monitor/wit/app.wit))
and exports the app's own service, written in WIT as a gRPC service is in
protobuf: `api`, functions the frame calls and waits for, and `jobs`, longer
work the Monitor runs as the app's job (one at a time), its lines streamed to
the frame. Every function returns `result<T, error>`; `error` holds gRPC's
canonical codes, which the frame gets as `DeskError` with the app's words in
`detail`.

```wit
package acme:notes;

interface api {
  use sbm:app/types@0.1.0.{error};
  record note { title: string, words: u32 }
  list: func(folder: string) -> result<list<note>, error>;
}

world notes {
  include sbm:app/imports@0.1.0;
  export api;
}
```

```ts
const notes = await desk.call<Note[]>('list', { folder: 'work' })
```

Parameters go as one object by name and values cross as JSON: names in
camelCase, a `variant` as `{ tag, val }`, an `option` as `null` or its value, a
`result` as `{ ok }` or `{ err }`. The Monitor checks the component when it is
installed and refuses one whose functions take or answer resources or
streams.

The Monitor runs it with wasmtime, in a fresh instance for each call or job;
what an app keeps goes through `kv`. It has no files, network or environment
of its own. Host functions:

| Function | Needs |
|---|---|
| `log` | — |
| `kv-get`, `kv-set`, `kv-remove` | — (the calling account's app storage, JSON texts) |
| `status` | `status` |
| `exec` | `process`: a script as the Monitor's system account |
| `exec-root` | `root`, and the sudo password the desk asked for with this call or job |
| `job.line`, `job.run-root` | In a job: a line of its log; a script as root, its output streamed to the log |

To run as root, the frame asks with `sudo: { title, body, confirmWord? }`;
the desk shows its own dialog with that text under the app's name, and sends
sudo's password to the Monitor with the request. Each call has 64 MiB of memory,
10 seconds of its own CPU time and 60 seconds in all; a job runs until it
returns or is cancelled. `process` and `root` follow the Monitor's transport
rule: HTTPS or a caller on the same host, unless `[remote_access]
allow_insecure`.

[`monitor/examples/desk-app-uptime`](https://github.com/lollipopkit/flutter_server_box/tree/main/monitor/examples/desk-app-uptime)
is a small example in Rust (wit-bindgen), and
[`monitor/apps/cleanup`](https://github.com/lollipopkit/flutter_server_box/tree/main/monitor/apps/cleanup)
a complete one with jobs and root:

```sh
cargo build --release --target wasm32-wasip2
cp target/wasm32-wasip2/release/desk_app_uptime.wasm backend.wasm
COPYFILE_DISABLE=1 tar -czf example.uptime.fsba manifest.json backend.wasm ui
```

[`monitor/examples/desk-app-hello`](https://github.com/lollipopkit/flutter_server_box/tree/main/monitor/examples/desk-app-hello)
is a `web` app without a build step.

## Test it

Install the package in **Settings → Apps → Installed** and approve it. Each new package needs approval again, so a test cycle is: pack,
install, approve, open. Remove the app to clear what it stored.

---

### Src Content Docs Development Monitor Agent (`docs/src/content/docs/development/monitor-agent.md`)

---
title: Monitor API and Access Model
description: Capability reporting, metrics history, and remote access behavior
---

The App uses the API behavior described here when it connects to the Monitor.
For installation and configuration, see
[Monitor](/docs/advanced/monitor-agent/).

## Protocol version

The App and the Monitor use a single protocol version number
(`sbm_parser::protocol`). It changes only for breaking API changes, such as
removing or renaming a field, changing a field's meaning, or removing a route.
New features do not change the protocol version; they are listed in `features`.

- `GET /api/v1/health` needs no sign-in and reports `protocol` and
  `min_client_protocol`. It does not report the release version, which is in
  `/capabilities`. A Monitor without these fields speaks protocol 1.
- Every request carries `X-SBM-Protocol: <n>`. A request without it is
  protocol 1. A Monitor answers a client below `min_client_protocol` with
  `426` and `{"error": "client_too_old", "protocol", "min_client_protocol"}`.
  `/health`, preflights and WebSocket upgrades are not checked; the
  `/ws-ticket` request before an upgrade is.
- Before signing in, the App reads `/health`. It prompts you to update the
  Monitor when its protocol is too old, or to update the App when the Monitor
  requires a newer protocol.
- The Monitor answers a client one protocol older in that client's format.
  The App reads no Monitor below protocol 2, and prompts you to update it.

## Capability discovery

The App calls `GET /api/v1/capabilities` to learn which features a Monitor
supports and whether the signed-in caller may use them. The response includes:

- `access`: `ok`, and when it is false, `why`. `insecure_transport` means
  the request needs TLS, a loopback caller, or
  `[remote_access] allow_insecure`. For a watch token `access` is
  `{"ok": false}`.
- `features`: the machine-management endpoints the Monitor serves, such as
  `power`. A client offers a page when its name is listed and `access.ok`.
  `container_exec`, `iperf`, and `tmux` are terminal targets rather than
  pages; each is offered only where it is listed. `alerts`, `audit`, and
  `live` are the Monitor tab's sections (`GET /alerts`, `GET /audit`,
  `/live*`), and `desk` its notifications. `update` is `GET /update`: the
  Monitor's version, the newest release it read (`?check=1` reads again),
  `outdated`, how it was installed (`install`: `script`, `container`, `nix`,
  `other`) and, for `script`, the `command` that updates it, whether starting
  it needs the sudo password, and the last update's `run` (state and output).
  `POST /update/run` starts it apart from the Monitor, which survives the
  Monitor's restart.

Do not infer feature availability from the Monitor version or configuration
defaults. Use the capabilities response from the running Monitor.

## Metrics history contract

The capabilities response reports:

- `retention_days`: the configured retention limit from
  `[monitoring.data_retention] metrics_days`.
- `oldest_sample`: the timestamp of the oldest metrics sample currently
  stored.

The App offers preset chart ranges that fit within the later boundary implied
by retention and the oldest sample. It displays both values in the range
picker. Older Monitor versions that do not report retention use the fixed chart ranges.

The App can request an exact interval with:

```text
GET /api/v1/metrics/history?from=<epoch-seconds>&to=<epoch-seconds>
```

If `from` precedes the oldest retained sample, the Monitor returns the available
rows. It does not shift the requested start time or return an error. The chart
represents the missing interval as a gap. Without `from`, `?minutes=` sets the
window's length (default 60, at least 5, at most 7 days), ending at `to` or
now. The App includes `minutes` in each request, so Monitor versions that predate
`from` and `to` can still handle it.

### Per-device detail

Each point carries the aggregate and, since migration 044, the devices behind
it: `mounts` (used and total bytes), `ifaces` (a rate, see below), `gpus`
(usage and memory in MiB) and `temps` (every temperature sensor). A field is
**absent** when that bucket holds no detail — every window older than
migration 044, and any Monitor that predates it — never an empty list, which
a client would read as "a machine with no mounts". A client that draws these
must treat a missing field as a gap, not as zeros.

Detail is stored as **stretches, not samples**. `metrics_disk_usage`,
`metrics_iface`, `metrics_gpu` and `metrics_temp` each hold one row per
stretch of time over which a device's reading held: `start`, `end` and the
value. A reading that does not move (a disk at 10 % all day) is one row per
hour (`MAX_SEGMENT`), not one row per sample; a reading that moves past its
table's threshold opens a new row. Stretches younger than 30 seconds are
extended and blended over elapsed time rather than cut, and no stretch runs
longer than an hour even unchanged — so sustained load cannot flood the tables
and a slowly drifting value still leaves points to draw.

Thresholds: disk usage 1 percentage point (1% of the mount's total, over
bytes), interface rate 50% change in either direction, GPU usage 5 points and
GPU memory 5% of its total, temperature 1 °C. An interface is recorded only
while it moves at least 10 KB/s in either direction — an idle link is no
detail, and most links are idle most of the time.

A stretch is open only while it was extended at the previous sample: a
device that disappears (a mount unmounted, an interface gone) closes its
stretch, and a returning device opens a new one — even when the reading it
returns with is the one it left with. An interface's stretch ends at the
last sample that saw traffic; the idle cycles in between belong to no
stretch.

In an answer, a stretch appears in **every bucket it overlaps**, with the
value it held: a six-hour stretch is six points in a one-hour-bucket answer,
not a spike at its start and a gap after. When multiple stretches of the same
device overlap a single bucket, they are merged into one duration-weighted
entry per device so every point lists each device at most once. Interface
figures are rates (`rx_bytes_per_sec`, `tx_bytes_per_sec`), so a client does
not derive them again from counters it may only hold part of.

## Access model

The Monitor has one account, signed in with its password alone, and it may do
whatever the system account the Monitor runs as may do. There are no roles,
grants, or file roots. The Monitor, the web panel, and the App share the
contract below.

Reading status, metrics, history, velocity, capabilities, and the card order
needs a login or a watch token. A watch token can do nothing else; every other
endpoint answers it `401`.

### Signing in and the password

| Endpoint | Body |
|---|---|
| `POST /api/v1/login` | `password`, `device` (optional), `name` (optional); a `username` field is ignored. Answers `token` and, for a device the Monitor does not know, a new `device` token |
| `PUT /api/v1/me/password` | `current_password`, `new_password` (at least 8 characters); answers `204` |

A client keeps the `device` token per Monitor (the App in the Keychain or
Keystore, the panel in `localStorage`) and sends it with every later sign-in.
`name` is what the device is listed as under `GET /live`, else its User-Agent:
at most 80 characters, control characters dropped. Every sign-in, accepted or
refused, is an audit row (`login`, the address, and `device known`,
`new device`, `wrong password` or `throttled`); it never holds the password or
a token.

Sign-ins are throttled per source address and per caller: a known device (its
token is kept as a SHA-256 for 180 days since last use, the newest 64) on its
own counter, every other client on one shared counter, and a signed-in caller
entering the password again on a counter only such callers share. Failures
from unknown clients therefore cannot lock out a device that signed in before.
Three failures pass per address and per device, twenty on the shared counter;
then the delay doubles from 1 s up to 5 min. A password change forgets every
device.

`server_box_monitor password` sets the password on the database from the
command line (`--password-env VAR` reads it from the environment), creating
the account if there is none.

Some changes ask for the current password again in the body
(`current_password`): changing the password, deploying a web app, changing its
settings or removing it, revealing its first login, restoring or deleting a
container backup, and approving or removing a desk app. It goes through the
login throttle described above. A wrong or missing one answers `403 reauth`; a run of wrong ones
answers `429 throttled` with `Retry-After`.

Errors are `{"error": "<code>", "message": "..."}`:

| Code | Status | Meaning |
|---|---|---|
| `bad_request` | 400 | The body has the wrong shape |
| `unauthorized` | 401 | No valid login, a token issued before the last password change, or a watch token outside its scope |
| `forbidden` | 403 | The transport rule refuses it |
| `reauth` | 403 | `current_password` is missing or wrong |
| `throttled` | 429 | Too many failed attempts |
| `not_found` | 404 | An unknown `/api/v1/*` path |

### API tokens and MCP

An MCP client (Claude Code, Claude Desktop, any Streamable HTTP client)
controls this machine through `POST /api/v1/mcp` with an **API token** (`sbt_`
+ 64 hex), shown once at creation and stored as its BLAKE3 hash.

| Endpoint | Body |
|---|---|
| `GET /api/v1/api-tokens` | Every token: `id`, `name`, `scopes`, `commands`, `created_at`, `expires_at`, `expired`, `last_used_at`, `last_used_ip` |
| `POST /api/v1/api-tokens` | `name`, `password` (re-authenticated), optional `scopes` (default: all), optional `commands` (default: `allow_all`), optional `days` (default 90, max 3650). Answers the row and `token_value` — once |
| `PUT /api/v1/api-tokens/{id}` | Updates `name`, `scopes`, and `commands`. Audited |
| `DELETE /api/v1/api-tokens/{id}` | `204`, or `404` when gone. Audited |
| `GET /api/v1/api-tokens/policy` | Global MCP ceiling (`scopes`, `commands`, `config_scopes`) |
| `PUT /api/v1/api-tokens/policy` | Updates global `scopes` and `commands`, live without restart. Audited |

Permissions default open — all 11 scopes enabled and `allow_all` commands — and
can be narrowed at three intersected layers: `config.toml` (`[mcp]`), the
UI-managed global policy (`mcp_policy`), and each token's own permissions.
There is no scope for managing tokens or the account itself. A token requires
TLS or a loopback caller as acting does; a password change deletes every token,
and the list records each token's last use (at most once a minute).

The protocol, the token format, the scopes, the tool catalog and the tools any
machine reached through a shell answers (processes, services, containers,
tmux, `run_command` and the actions) are `crates/sbm_mcp`, shared with the
app's own MCP server.

`POST /api/v1/mcp` speaks Streamable HTTP in its stateless JSON shape: one
JSON-RPC message per POST, answered with one `application/json` body, a
notification by `202`, and `405` (`Allow: POST`) for `GET` or `DELETE`. The
client must send `Accept: application/json` and `Content-Type: application/json`;
a body over 4 MiB is `413` before it is read; an `Origin` not in
`cors_allowed_origins` (or same-origin) is `403`. The protocol header is not
required; the MCP protocol version is negotiated in `initialize`.

`tools/list` answers only what the effective scopes allow. Every `tools/call`
is an audit row (`mcp`), naming the tool and the token; arguments are not
recorded, except that `run_command` records the programs the command runs,
its size and the start of its BLAKE3 digest before running it, as `POST /exec`
and Agent mode's bypass do (`set, mysql (412 bytes, blake3 1a2b…)`: no
argument or value), and `fs_*` tools record `fs` audit rows.

| Scope | Tools |
|---|---|
| `read` | `machine_status`, `machine_metrics`, `machine_capabilities`, `processes`, `services`, `containers`, `cron`, `tmux`, `firewall`, `storage`, `virt`, `stacks`, `system_users` |
| `fs_read` | `fs_roots`, `fs_list`, `fs_stat`, `fs_read` |
| `fs_write` | `fs_write`, `fs_mkdir`, `fs_rename`, `fs_chmod`, `fs_remove` |
| `exec` | `run_command` |
| `process` | `kill_process` |
| `service` | `service_action` |
| `container` | `container_action` |
| `cron` | `cron_edit` |
| `virt` | `virt_power` |
| `stacks` | `stack_action` |
| `power` | `power` |

#### Command rules and `config.toml` ceiling

Both the global policy (`/api/v1/api-tokens/policy`) and individual tokens
carry `commands: { mode: "allow_all" | "allowlist", allow: [...], deny: [...] }`
using the same pattern matcher as Agent mode (`fl_pi_llm::permissions::rules`).
By default (`allow_all`), any command runs unless a `deny` rule matches any
part of it; in `allowlist` mode, `allow` must cover every part of the command.
An optional `[mcp]` section in `config.toml` sets a hard operator ceiling on
top:

```toml
[mcp]
disabled_scopes = []
allow_power = true

[mcp.commands]
mode = "allow_all"
allow = []
deny = ["rm -rf /"]
```

A `sudo` password has no way in through MCP: an action that needs root answers
`sudo_rejected`, for the operator to do from the panel or with passwordless
`sudo`.

### Password change

A password change signs out everything else. Panel tokens issued before it
answer `401` everywhere (a token from the same second still counts, so
signing in again right after works), watch tokens and the LK Cloud session are
deleted, and in a running Monitor
terminal sessions, outstanding tickets, running Agent mode tasks, web app
windows, relays, and listeners receive
`{"type":"error","code":"password_changed"}` and are closed. A reset from the
command line cannot reach a running Monitor's open connections; they end when
the Monitor restarts.

### Transport

Everything beyond reading needs TLS or a loopback caller, which includes a
reverse proxy on the same host, unless `[remote_access] allow_insecure = true`.
For backward compatibility, `[remote_access.terminal] allow_insecure` and
`[remote_access.fs] allow_insecure` are also accepted as aliases. A plaintext connection from
the App also needs **Allow insecure HTTP** for that server. Without either,
capabilities report `access` with `why: insecure_transport`, and the
endpoints answer `forbidden`.

### Monitor tab endpoints

| Endpoint | Answers | Rule |
|---|---|---|
| `GET /api/v1/alerts` | `checked_at`, `alerts`: `rule`, `monitor_type`, `matcher`, `threshold`, `value`, `since` for each rule firing at the last check (kept in memory: a restart forgets `since`) | Any login |
| `GET /api/v1/update[?check=1]` | `version`, `latest`, `checked_at`, `error`, `outdated`, `install`, `command`, `needs_password`, `run`. The release is read every 12 hours; `check=1` reads it again, at most once a minute. `run` is `state` (`running`, `done`, `failed`, `interrupted`), `started_at`, `exit`, `lines` | Any login |
| `POST /api/v1/update/run` | `202`. Takes `password` (sudo's) where `needs_password`; a wrong one is `403 sudo_password`. `409 not_script` when `install.sh` did not install the Monitor, `409 running` while an update runs. Audited | Transport |
| `GET /api/v1/audit?limit&before&kind&result` | `entries` (`id`, `timestamp`, `kind`, `action`, `result`, `subject`, `remote_ip`, `ssh_user`, `detail`), newest first, and `next` for `before`. An unknown `kind` or `result` is `400 invalid_input` | Transport |
| `GET /api/v1/live` | `sessions`, `connections`, `watch_tokens`, `devices` | Transport |
| `DELETE /api/v1/live/{sessions,connections,devices}/{id}` | `204`, or `404` when it is gone. An ended session or connection is told `ended`; a forgotten device is not signed out, but its next sign-in counts as an unknown client's and gets a new token. Audited | Transport |

### File API

`/api/v1/fs/*` reaches whatever the Monitor's system account can, except the
Monitor's own state: its database and journal files, `jwt.secret`, `credentials.key`,
`initial-admin-credentials.txt`, `config.toml` and its backups, `.env`, the
TLS certificate and key, the custom-commands directory, the blob store,
stacks' `.env` files, and container backups. These paths are matched after
resolving symlinks, refused with `403`, left out of listings, and their
directories cannot be renamed, removed, or chmod-ed.

### Terminal endpoint

The terminal of the App and of the web panel is a local shell running as the
Monitor process user, on a PTY. The Monitor does not sign in to sshd: an `open`
carrying SSH credentials is refused.

---

### Src Content Docs Development Monitor Apps (`docs/src/content/docs/development/monitor-apps.md`)

---
title: Developing Monitor Apps
description: Build and test web apps for the Monitor
---

Monitor apps are Docker Compose packages under `store/apps/<publisher>.<name>/`.
The Monitor reads their `manifest.toml` and Compose files, and the desk shows
installed apps in a window.

Start with the [`serverbox-webapp` skill](https://github.com/lollipopkit/flutter_server_box/blob/main/.claude/skills/serverbox-webapp/SKILL.md)
when creating or changing an app. Its
[manifest reference](https://github.com/lollipopkit/flutter_server_box/blob/main/.claude/skills/serverbox-webapp/references/manifest.md)
describes each field. The editor schema is
[`docs/schemas/monitor-app.schema.json`](https://github.com/lollipopkit/flutter_server_box/blob/main/docs/schemas/monitor-app.schema.json);
the skill's `scripts/validate.py` also checks rules that the schema cannot
express, and can run Compose validation.

To try an app on a development Monitor, place its package in a directory and set
`[stacks] local_apps` in that Monitor's `config.toml` to the directory containing
the `<publisher>.<name>/` folder. For example:

```toml
[stacks]
local_apps = "/srv/sbm-apps"
```

Restart the Monitor after changing a local package. The App Store reads the local
catalog entry, so you can install it and test the deploy flow without adding it
to the shipped catalog. For a package at `store/apps/example.web`, validate it
from the repository root with:

```sh
python3 .claude/skills/serverbox-webapp/scripts/validate.py store/apps/example.web --compose
```

---

### Src Content Docs Development State (`docs/src/content/docs/development/state.md`)

---
title: Riverpod Patterns
description: Provider, asynchronous state, and resource-lifecycle patterns used by Server Box
---

Server Box uses Riverpod and `riverpod_generator` to connect UI state,
asynchronous data, and services.

## Provider structure

```text
UI Widget
    │ ref.watch / ref.read
Provider
    │
Service / Store
    │
State update
```

Widgets subscribe with `ref.watch` and invoke notifier methods with
`ref.read(...notifier)`. Providers coordinate services and stores, while
Widgets handle presentation and user interaction.

## Provider types

### `NotifierProvider`

Use a class-based `@riverpod` declaration for synchronous state with update
methods. The generator creates a `NotifierProvider`:

```dart
@riverpod
class Settings extends _$Settings {
  @override
  SettingsModel build() => SettingsModel.defaults();

  void update(SettingsModel value) {
    state = value;
  }
}
```

This pattern is not a `StateProvider`. Keep validation, persistence, and
related state updates in the notifier.

### `AsyncNotifierProvider`

Use `AsyncNotifierProvider` when loading data can take time or fail:

```dart
@riverpod
class ServerStatus extends _$ServerStatus {
  @override
  Future<StatusModel> build(Server server) async {
    return fetchStatus(server);
  }

  Future<void> refresh() async {
    state = const AsyncValue.loading();
    state = await AsyncValue.guard(() => fetchStatus(server));
  }
}
```

Handle all `AsyncValue` cases in the Widget:

```dart
final status = ref.watch(serverStatusProvider(server));

return status.when(
  data: (value) => StatusWidget(value),
  loading: () => const LoadingWidget(),
  error: (error, stack) => ErrorWidget(error),
);
```

### `StreamProvider`

Use `StreamProvider` for values emitted over time:

```dart
@riverpod
Stream<CpuUsage> cpuUsage(Ref ref, Server server) {
  return ref.watch(cpuServiceProvider).monitor(server);
}
```

Release resources owned by the stream from `ref.onDispose`.

### Family providers

A parameterized provider keeps separate state for each argument set. For
example, each server can have its own container list:

```dart
@riverpod
Future<List<Container>> containers(Ref ref, Server server) async {
  final client = await ref.watch(sshClientProvider(server).future);
  return client.listContainers();
}
```

`containersProvider(server)` and `containersProvider(server2)` refer to
independent state.

### Auto-dispose

By default, Riverpod may dispose a provider after its last listener is gone.
Set `keepAlive` only when the state must outlive that point:

```dart
@Riverpod(keepAlive: true)
class TemporaryState extends _$TemporaryState {
  // ...
}
```

Keeping an unused provider alive retains its resources as well.

## Reading and updating state

Watch a provider while building a Widget:

```dart
class ServerWidget extends ConsumerWidget {
  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final status = ref.watch(serverStatusProvider(server));
    return status.when(...);
  }
}
```

Call the notifier to perform an update:

```dart
ref.read(settingsProvider.notifier).update(newSettings);
```

Use `select` when a Widget depends on only part of a value. Changes to other
parts then do not rebuild it.

## Derived state

If a value can be computed from existing providers, derive it instead of
keeping a second mutable copy:

```dart
@riverpod
int totalServers(Ref ref) {
  return ref.watch(serversProvider).length;
}

@riverpod
List<Server> onlineServers(Ref ref) {
  return ref.watch(serversProvider).where((server) => server.isOnline).toList();
}
```

## Reactive refresh

For periodic refreshes, create a timer after the initial load and cancel it
when the provider is disposed. Check `ref.mounted` after awaiting the initial
request, so disposal during that request does not leave a timer behind. Do not
start the timer before the initial load completes: its result could overwrite
the first refresh.

```dart
@riverpod
class AutoRefreshServerStatus extends _$AutoRefreshServerStatus {
  Timer? _timer;

  @override
  Future<StatusModel> build(Server server) async {
    ref.onDispose(() => _timer?.cancel());
    final status = await fetchStatus(server);
    // Disposed while the fetch was in flight: onDispose has already run, so a
    // timer started now is one nothing cancels.
    if (!ref.mounted) return status;
    // Started once the first fetch has landed. A tick that fired while it was
    // still running would set state that this build's own result then
    // overwrites.
    _timer = Timer.periodic(const Duration(seconds: 5), (_) => refresh());
    return status;
  }

  bool _refreshing = false;

  Future<void> refresh() async {
    // A tick that arrives while the previous fetch is still running is
    // dropped. Two in flight can finish out of order, and the older answer
    // would then overwrite the newer one.
    if (_refreshing) return;
    _refreshing = true;
    try {
      state = const AsyncValue.loading();
      state = await AsyncValue.guard(() => fetchStatus(server));
    } finally {
      _refreshing = false;
    }
  }
}
```

Refreshes can also be requested by startup, lifecycle changes, or bulk
actions. `ServerRefreshScheduler`
(`lib/data/provider/server/refresh_scheduler.dart`) serializes the work in one
global queue and reuses the Future for a server that is already queued or
refreshing. Concurrent requests for the same server therefore start one
refresh, and no more than `maxConcurrent` servers refresh at once.

## Best practices

1. Keep providers near the feature that uses them.
2. Prefer `@riverpod` and code generation.
3. Give each provider one clear responsibility.
4. Handle the data, loading, and error states of every `AsyncValue`.
5. Release streams, timers, and connections from `ref.onDispose`.
6. Keep UI logic separate from business logic.
7. Avoid unnecessary `keepAlive` settings and deeply nested provider graphs.

---

### Src Content Docs Development Structure (`docs/src/content/docs/development/structure.md`)

---
title: Project Structure
description: Understand the Server Box codebase
---

The repository is a monorepo. The Flutter App is at the root, alongside the
Rust workspace, Monitor, documentation site, and project website.

## Monorepo layout

```text
flutter_server_box/
├── lib/               # Flutter App
├── crates/
│   ├── sbm_parser/    # Shared status parser for App and Monitor
│   ├── sbm_ffi/       # flutter_rust_bridge binding crate
│   └── sbm_native/    # Native sampler used by the Monitor
├── monitor/           # Monitor (Rust service + Svelte panel)
├── packages/          # Path-dependent Dart forks and shared webui package
├── docs/              # Astro Starlight documentation site
├── website/           # Project website
└── Cargo.toml         # Rust workspace root
```

## Flutter App directories

```text
lib/
├── core/              # Core utilities, extensions, and routing
├── data/              # Models, providers, stores, and SSH sessions
│   ├── model/
│   ├── provider/
│   ├── store/         # SQLite storage
│   ├── helper/
│   ├── res/
│   ├── service/       # systemd/procd/OpenRC and cron/user managers
│   └── ssh/
├── view/              # Pages and reusable Widgets
├── generated/         # Generated localization code
├── l10n/              # Localization source ARB files
├── hive/              # Legacy Hive migration readers
└── src/rust/          # Generated flutter_rust_bridge bindings
```

These paths and files are generated outputs: `lib/src/rust/`,
`lib/generated/`, `*.g.dart`, and `*.freezed.dart`. Make changes in their
source definitions and regenerate them; do not edit the outputs by hand.

## Core code

### `lib/core/`

Contains extensions, routing, and utilities shared across features. Keep
page-specific business state in its provider or service.

### `lib/data/model/`

Models are organized by feature:

- `server/`: Server configuration, credentials, and status
- `container/`: Docker and Podman containers
- `file/`: Remote file models
- `ssh/`: SSH session models
- `ai/`: AI conversation and command models
- `app/`: App configuration and state

### `lib/data/provider/`

Riverpod providers coordinate dependencies, asynchronous operations, and state
shared across pages. They generally call services or stores; keep data access
out of UI Widgets.

### `lib/data/store/`

The local data layer uses an encrypted SQLite database:

- `SqliteStore` handles key-value data, including settings and history.
- Entity stores handle relational data, including servers, private keys, and snippets.
- Migrations upgrade stored data between App versions.

### `lib/view/`

`page/` contains the main screens. `widget/` contains reusable components,
such as server cards, status charts, inputs, and dialogs.

## Packages

Most directories in `packages/` are forks referenced through local path
dependencies:

- `dartssh2/`: SSH client
- `xterm/`: Terminal emulator
- `fl_lib/`: Shared UI components and utilities
- `fl_build/`: Cross-platform build tool
- Other platform plugins and component packages

`packages/webui/` is used by the project website. This
Svelte package provides UI primitives and design tokens.

## Rust workspace

- `crates/sbm_parser/` parses command output into structured server status. The App calls it through FFI; Monitor uses it in its script collection path.
- `crates/sbm_native/` samples metrics on the host running Monitor, using syscalls, procfs, or sysfs. The App collects remote data over SSH and does not call this crate on a remote host.
- `crates/sbm_ffi/` exposes Rust APIs to Flutter, including the parser and native SSH cryptography. Generated Dart bindings are in `lib/src/rust/`.
- `monitor/` contains the standalone Monitor. See `monitor/README.md` for its documentation.

The App collects metrics from remote servers over SSH. Monitor collects them
from the host where it runs. The projects share selected models and parser
code, while using separate collection pipelines.

---

### Src Content Docs Development Testing (`docs/src/content/docs/development/testing.md`)

---
title: Testing
description: Run and write tests for Server Box
---

## Running tests

```bash
# Flutter and Dart tests
flutter test

# A specific test file
flutter test test/unit/server/disk_test.dart

# Generate a coverage report
flutter test --coverage
```

## Test structure

Dart tests live in `test/` and are grouped into `unit/`, `widget/`, `platform/`, and `migration/`. Shared helpers and release fixtures live in `helpers/` and `fixtures/`. Tests should verify behavior and input/output without depending on an external network or a real server.

`unit/` is divided by feature: `ssh/`, `terminal/`, `file/`, `server/`, `store/`, `ai/`, `geo/`, `rootfs/`, `monitor/`, `benchmark/`, `remote_desktop/`, `virt/`, `workspace/`, `view/`, and `app/`; the theme tests (`theme_*_test.dart`) sit at its top level. Keep a feature's store, provider, and model tests together. `store/` contains shared storage infrastructure (database, schema, backup and restore, settings); `app/` contains version, localization, crash reporting, diagnostics, and build checks.

## Rust tests

```bash
# All tests in the Rust workspace
cargo test --workspace

# FFI parity test: build the FFI crate first
cargo build -p sbm_ffi
flutter test test/unit/app/frb_parser_test.dart
```

`crates/sbm_parser/tests/dart_compat.rs` uses the same fixtures as the Dart tests to lock parser behavior on both sides.

### Opt-in tests

The following suites need a real host. They are skipped silently when the required environment variables are not set:

```bash
# SSH end to end: upload the generated script, run it remotely,
# and compare the parsed result with direct command output.
# Set this in the workspace-root .env:
# SBM_E2E_SSH_HOST=<SSH destination or ~/.ssh/config alias>
cargo test -p sbm_parser --test ssh_e2e

# A server reached through a jump's OpenSSH master (ControlMaster):
# a master running for the jump, a target only the jump reaches.
# See the file's header for each variable.
SBM_E2E_MUX_JUMP=127.0.0.1:2222 SBM_E2E_MUX_USER=e2e \
SBM_E2E_MUX_CONTROL_PATH='/tmp/cm-%C' SBM_E2E_MUX_TARGET=target \
SBM_E2E_MUX_AGENT=/tmp/agent.sock \
flutter test test/e2e/control_master_test.dart
```

## Monitor panel tests

The Monitor Svelte frontend has an independent Vitest and Testing Library suite:

```bash
cd monitor/frontend
npm run test
npm run test:coverage
npm run check
```

`npm run check` performs type checking and is also part of `npm run build`.

## Unit tests

Use unit tests for pure business logic, models, and parsers:

```dart
test('calculates CPU percentage', () {
  final cpu = CpuModel(usage: 75.0);
  expect(cpu.usagePercentage, '75%');
});
```

## Widget tests

Use Widget tests for layout, text, and interaction:

```dart
testWidgets('shows the server name', (tester) async {
  await tester.pumpWidget(
    ProviderScope(
      child: MaterialApp(
        home: ServerCard(server: testServer),
      ),
    ),
  );

  expect(find.text('Test Server'), findsOneWidget);
});
```

A widget test that writes to a store must call `openTestDb()` in `setUp` and `closeTestDb()` in `tearDown`. The latter drains pending writes before closing SQLite. Construct the normal store against the isolated database; migration tests use the production `setting` store name. Do not add production reset methods, test-only constructors, or mutable network factories. Stateful services use their normal instance lifecycle; HTTP and filesystem substitutes belong in `test/helpers/`.

Do not use `pumpAndSettle()` on a tree containing a text field or another Widget that continually schedules frames. Count frames explicitly with `pump(duration)` instead, and use a reasonable test timeout.

## Provider tests

Use Provider tests to verify state and asynchronous results:

```dart
test('returns server status', () async {
  final container = ProviderContainer();
  addTearDown(container.dispose);

  final status = await container.read(serverStatusProvider(testServer).future);
  expect(status, isA<StatusModel>());
});
```

## External dependencies

The default test suite must remain deterministic. Parser, model, command-builder, and ordinary Widget tests must not access a network or a real server. When a feature introduces a service boundary, add a targeted fake or fixture.

The SSH end-to-end suite above is an exception. It runs only when their environment variables are configured, so a default `cargo test --workspace` still needs no external service.

## Storage migration tests

A storage migration usually gets one chance to process a user's data. Once it writes its completion marker, the old data is not read again. A migration bug is therefore more likely to silently lose data than to crash.

Every migration must keep a permanent regression test using bytes written by the release being migrated from, not data regenerated by the current adapter:

| File | Purpose |
|---|---|
| `test/migration/hive_release_migration_test.dart` | Runs Hive import and the registered migrations against each release fixture |
| `test/fixtures/hive_v{1466,1480,1491}/` | Boxes written by those releases, plus their generators and documentation |
| `test/migration/hive_import_test.dart` | Verifies import retry, idempotency, and per-box progress |
| `test/migration/m0NN_*_test.dart` | One per schema migration, verifying that step's behavior |

A fixture generated with the current adapter only proves that the current code agrees with itself. It cannot prove that the current decoder still reads the format written by an old release. Once a fixture is used for regression coverage, never regenerate it to make a failing test pass.

### Creating a release-authentic fixture

1. Check out the target release with `git worktree add /tmp/<tag> <tag>`, initialize the submodules required by its `pubspec.yaml`, and run `flutter pub get`.
2. Copy `test/fixtures/hive_v1466/gen_fixture.dart.txt` into a temporary test. Adapt it to that release's models, adapters, and dependency versions, then generate `.hive` bytes with the old release's own code. Cover every optional field, every enum value, every store type, and include non-ASCII text, quotes, and newlines.
3. Copy the generated files into `test/fixtures/hive_v<tag>/`, keep the generator notes and README, then remove the worktree.
4. Write the current-version reading test through the public store API, and check that the database encoding contains no fields from the old shape.

The generator is checked in as `.txt` because it targets an old release's API and is not expected to pass analyze in the current tree.

## Integration tests

`integration_test/` covers questions that `flutter test` cannot answer. Unit tests run under `flutter_tester`, which does not load plugins. Code reached through a plugin or FFI therefore does not execute in the real App environment there. Integration tests run on a connected device or simulator:

| File | What it verifies |
|---|---|
| `local_shell_test.dart` | Whether a shell on the device can actually start |
| `rootfs_shell_test.dart` | Whether the Alpine userland works through the App's API |
| `android_exec_test.dart` | What Android permits the App to execute from its own directory |
| `android_rootfs_test.dart` | Whether the Android guest mechanism works |
| `ios_rootfs_test.dart` | The Linux userland on iOS |
| `ios_bench_test.dart` | Linux guest overhead on real hardware |
| `ios_load_test.dart` | App overhead while the guest is running |
| `sandbox_import_test.dart` | Taking over data from the App Store sandbox build |

```bash
# Requires a connected device or simulator
flutter test integration_test/local_shell_test.dart
```

`make analyze` also analyzes `integration_test/`.

### Wireless iOS 17+ devices

When Xcode connects to an iOS 17+ device over the network, publish the driver port:

```bash
flutter drive --publish-port \
  --driver=integration_test/driver.dart \
  --target=integration_test/ios_rootfs_test.dart
```

The device may request local-network permission on the first run. Allow it for the test to connect.

## Testing recommendations

1. Organize tests with Arrange–Act–Assert.
2. Name tests after the behavior they verify, not the implementation.
3. Add enough assertions for important behavior while keeping each test focused.
4. Isolate external dependencies with fakes or fixtures.
5. Cover empty lists, missing values, invalid input, and permission failures.

## Fixtures

Signed rootfs fixtures must retain their original bytes: JSON uses LF and signatures are binary in `.gitattributes`. Never re-sign or regenerate a fixture to make a test pass — a fixture is bytes a release actually wrote, and rewriting it only proves the current code agrees with itself.

Where a test can, it should use the production path rather than a substitute: fixtures go through the real installer, and HTTP tests use a local socket.

---

### Src Content Docs Development Theme Authoring (`docs/src/content/docs/development/theme-authoring.md`)

---
title: Theme Package Authoring
description: Theme package format, validation, and publishing
---

`.fsbt` is a ZIP archive. Its root contains `manifest.toml` (UTF-8 TOML),
optional `background.png` / `background.jpg` / `background.jpeg`, optional
`icons/` files, and an optional `splash_logo.png` / `.jpg` / `.jpeg` / `.svg`.
Format version 1 contains UI colors, in-app icons, a background, component
radii, and a splash screen. Launcher icons and fonts are managed separately and
are not accepted in a theme package.

The [Aurora example](https://github.com/lollipopkit/flutter_server_box/blob/main/docs/examples/aurora/manifest.toml)
demonstrates the package format. To preview a theme while developing on
desktop, select **Install theme → Folder** and choose
its source directory. The app validates and copies the files; select the folder
again after editing to load the changes. To distribute the package, ZIP the
directory contents with `manifest.toml` at the archive root and use the `.fsbt`
extension.

For how built-in themes are packaged, loaded, and distributed, see
[Themes](/docs/development/themes/). For the user-facing guide to choosing and
installing themes, see [Themes for users](/docs/advanced/theme-packages/).

```toml
id = "example.amethyst"
name = "Amethyst"
modes = ["dark"]

# An SVG icon, an icon color, and a splash are schema 2 features, so the
# minimum this package is readable at is 2. See "Schema versions".
[schema]
min = 2
max = 2

[colors]
mode = 2
seed = 0xFF880E4F

[colors.palette.dark]
primary = 0xFFC87FD0
surface = 0xFF141014

[icons.images]
"tab.server" = "icons/tab_server.svg"
"nav.settings" = "icons/nav_settings.png"

# Per-icon colors: an ARGB integer or the name of a palette role.
[icons.colors]
"tab.server" = "primary"
"nav.settings" = 0xFFC87FD0

[background]
type = "image"
image = "background.png"
blur = 8

[splash]
color = "surface"
logo = "splash_logo.svg"
duration = 900
```

Only `id`, `name`, `modes`, and the `schema` table are required; an
[icon pack](#icon-packs) has no `modes` and requires `kind` and `icons.images`
instead. Omitted fields use
these defaults; an entire table may be omitted. Partial tables override only
the fields supplied. Explicit zero values are preserved, and invalid values
are rejected rather than replaced with defaults.

| Field | Default |
| --- | --- |
| `format` | `1` |
| `colors.mode` | `0` (system) |
| `colors.seed` | `0xFF880E4F` |
| `colors.systemColor` | `false` |
| `colors.palette.light`, `colors.palette.dark` | Empty |
| `icons.style` | `"classic"` |
| `icons.images` | Empty |
| `icons.colors` | Empty (follow the ambient icon color) |
| `splash` | Absent (no splash) |
| `background.type` | `"none"` |
| `background.opacity` | `0.18` |
| `background.blur` | `0` |
| `background.tile` | Absent (the image is drawn once, cover-fitted) |
| `shapes.card`, `shapes.tile`, `shapes.button` | `12`, `8`, `10` |
| `components` | Empty (inherit app styles) |

The Default theme remains a Dart const and keeps its original radii (`13`, `9`,
`30`). The defaults above apply to themes imported from folders and `.fsbt`
archives.


`modes` must declare `["light"]`, `["dark"]`, or `["light", "dark"]`.
Empty lists, duplicates, and unknown modes are rejected. A single supported mode
locks the app's ThemeMode even when the system appearance changes. The settings
row explains that switching modes requires a theme that supports the other
mode. Themes supporting both modes allow System, Light, and Dark.
`colors.mode` is the initial preference: 0 (system), 1 (light), or 2 (dark).
A single supported mode overrides this preference. AMOLED is a bundled theme
that supports both modes, with generated light colors and black dark surfaces.
Legacy AMOLED settings migrate to Dark + AMOLED; Auto AMOLED migrates to
System + AMOLED. AMOLED is no longer a ThemeMode option.
`format` versions the ZIP manifest structure. `schema` is the inclusive range
of theme UI schema versions the package supports. The app currently supports
schema **v1–v4** and shows this range in the **Install theme** help text. The
installer requires the package range to overlap the app range and checks it again when
loading an installed theme. Both `schema.min` and `schema.max` are required.
`seed` and palette colors are ARGB integers; hexadecimal TOML values such as
`0xFF61AFEF` are supported. `icons.style` is `classic` or `mingcute` and is used
where the package does not provide an image. `background.type` is `none`,
`gradient`, or `image`; omit `image` unless the type is `image`. Opacity is
0–0.6, blur is 0–30, and each shape radius is 0–40. `background.tile`
(schema 3, image only, 16–1024) repeats the image as a pattern, each repeat that
many logical pixels wide from the top left, instead of stretching one copy over
the window: draw a seamless tile with a transparent background, and the
surface color shows through it.
Image paths must match the fixed names above. The installer rejects other
archive entries, duplicate paths, symlinks, encrypted files, and path traversal.
Unknown top-level tables are rejected, so misspelled sections produce an error
instead of being silently ignored.

## Manifest schema for editors

The manifest is validated against a JSON Schema. Editors can report unknown
tables and fields, out-of-range values, unsupported icon keys, and icon file
names that do not match their keys as you edit:

```text
https://raw.githubusercontent.com/lollipopkit/flutter_server_box/main/docs/schemas/fsbt-manifest.schema.json
```

TOML editors that support the Taplo schema directive, including Taplo, Even
Better TOML for VS Code, and Tombi, read the schema from the first line of the
file. The [example](https://github.com/lollipopkit/flutter_server_box/blob/main/docs/examples/aurora/manifest.toml)
uses this directive:

```toml
#:schema https://raw.githubusercontent.com/lollipopkit/flutter_server_box/main/docs/schemas/fsbt-manifest.schema.json
```

For editors that associate schemas by file name, configure the same URL in the
editor's settings. The directive is the only editor-independent option.

The schema is as strict as the installer except for one rule: it cannot require
each key in `icons.colors` to appear in `icons.images`, because that check spans
two tables. The installer rejects all other errors reported by the schema.
The schema describes the latest version, so packages declaring `min = 1` still
validate. See
[Themes](/docs/development/themes/#the-parser-and-the-editor-schema).

## Schema versions

`schema.min` is the oldest app schema version that can read the package. The
installer checks compatibility against the app's supported range. It does not
migrate incompatible packages: packages with non-overlapping ranges are not
installed, and an installed package that later becomes incompatible is not
loaded. It is shown as unreadable, and its settings are left unchanged.

Schema **2** added SVG icons, `icons.colors`, and the `splash` table. A package
using any of these features must declare `min = 2`. Otherwise, a schema 1 build
could install the package but silently discard those features: SVG icons would
fall back to built-in glyphs, and custom colors and splash screens would not
appear.

Schema **3** added the components beyond schema 2's seven (`textButton`,
`outlinedButton`, `iconButton`, `search`, `appBar`, `segmented`, `sidebar`,
`menu`, `tooltip`, `toast`, `switch`, `slider`, `progress`, `badge`, `chip`,
`divider`, `scrollbar`), the `minHeight` field of button tables,
`background.tile`, and the `[layout]` and `[variants]` tables. A package using any of them must declare `min = 3`: a schema
2 build refuses an unknown table, and the store needs to know that before the
download.

Schema **4** raised the icon limit from 48 to 128, and added
[icon packs](#icon-packs). A package carrying more than 48 icons, and every
icon pack, must declare `min = 4`: a schema 3 build refuses either. The current
ceiling is `max = 4`; a package whose range extends beyond it can still be
installed if the ranges overlap.

## Icons

`icons.images` maps an icon key to the file that carries it, inside `icons/`.
The file name must be the key with dots replaced by underscores, and either
extension:

```toml
[icons.images]
"tab.server" = "icons/tab_server.svg"
"nav.settings" = "icons/nav_settings.png"
```

A PNG is at most 512 × 512 pixels and 256 KiB. An SVG has no raster size to
measure, so it is checked as a document instead: it must be UTF-8, its root
element must be `svg`, and it is at most 256 KiB. A DTD, an entity declaration,
a `<script>`, a `<style>`, a `<foreignObject>`, or anything that reaches outside
the file — an `href` that is not a fragment of this document, or a `url(…)` that
is not — is refused. A refused or missing icon draws the built-in glyph for that
key rather than an empty box.

Both formats are tinted with one color, so a drawing should use `currentColor`
for the parts that should follow it. Without `icons.colors` that color is the
ambient icon color, which is what every icon used before a package could say
otherwise. With it, each entry overrides that color for one icon:

```toml
[icons.colors]
"tab.server" = "primary"       # any palette role, resolved per brightness
"nav.settings" = 0xFFC87FD0    # or an ARGB integer
```

A color for a key the package carries no image for is refused: it would be a
typo that shows up as nothing at all.

The Files window's `file.*` icons are the exception: they keep the colors they
were drawn with, since language logos all look alike in one color. Only an
`icons.colors` entry tints one, and its `currentColor` is the text color.

## Color palettes

`colors.palette.light` and `.dark` accept all 46 non-deprecated ColorScheme
roles below. Unspecified roles come from the seed. Unknown and deprecated
roles are rejected. Palette values are ARGB integers.

```text
primary, onPrimary, primaryContainer, onPrimaryContainer
primaryFixed, primaryFixedDim, onPrimaryFixed, onPrimaryFixedVariant
secondary, onSecondary, secondaryContainer, onSecondaryContainer
secondaryFixed, secondaryFixedDim, onSecondaryFixed, onSecondaryFixedVariant
tertiary, onTertiary, tertiaryContainer, onTertiaryContainer
tertiaryFixed, tertiaryFixedDim, onTertiaryFixed, onTertiaryFixedVariant
error, onError, errorContainer, onErrorContainer
surface, onSurface, surfaceDim, surfaceBright
surfaceContainerLowest, surfaceContainerLow, surfaceContainer, surfaceContainerHigh
surfaceContainerHighest, onSurfaceVariant, outline, outlineVariant
shadow, scrim, inverseSurface, onInverseSurface
inversePrimary, surfaceTint
```

## Component styles

Use `[components.card]` for common values and `[components.light.card]` or
`[components.dark.card]` for brightness-specific overrides. All tables and
fields are optional. Missing fields preserve the app's style; explicit zero
and `false` are retained. Component `radius` takes precedence over `[shapes]`.
Colors accept an ARGB integer or any ColorScheme role name (for example
`backgroundColor = "surfaceContainer"`), resolved against the final palette.
Unknown component names, fields, states and role names are rejected.

| Component | Supported fields |
| --- | --- |
| `card` | `backgroundColor`, `radius`, `borderColor`, `borderWidth`, `elevation`, `shadowColor`, `surfaceTintColor`, `margin` |
| `tile` | `backgroundColor`, `selectedTileColor`, `textColor`, `iconColor`, `selectedColor`, `radius`, `borderColor`, `borderWidth`, `padding` |
| `button` | `backgroundColor`, `foregroundColor`, `overlayColor`, `radius`, `borderColor`, `borderWidth`, `elevation`, `shadowColor`, `surfaceTintColor`, `padding`, `minHeight`³ |
| `input` | `filled`, `fillColor`, `radius`, `borderColor`, `borderWidth`, `focusedBorderColor`, `errorBorderColor`, `disabledBorderColor`, `padding` |
| `navigation` | `backgroundColor`, `indicatorColor`, `indicatorRadius`, `selectedIconColor`, `unselectedIconColor`, `selectedLabelColor`, `unselectedLabelColor`, `elevation` |
| `dialog` | `backgroundColor`, `radius`, `borderColor`, `borderWidth`, `elevation`, `shadowColor`, `surfaceTintColor`, `barrierColor`, `insetPadding` |
| `sheet` | `backgroundColor`, `radius`, `borderColor`, `borderWidth`, `elevation`, `shadowColor`, `surfaceTintColor`, `barrierColor`, `dragHandleColor` |
| `textButton`³, `outlinedButton`³ | The fields of `button` |
| `iconButton`³ | The fields of `button`, `iconSize` |
| `search`³ | `backgroundColor`, `radius`, `borderColor`, `borderWidth`, `elevation`, `iconColor`, `textColor`, `hintColor`, `height`, `padding` |
| `appBar`³ | `backgroundColor`, `foregroundColor`, `titleColor`, `iconColor`, `elevation`, `shadowColor`, `surfaceTintColor` |
| `segmented`³ | `backgroundColor`, `selectedColor`, `textColor`, `selectedTextColor`, `radius`, `borderColor`, `borderWidth` |
| `sidebar`³ | `backgroundColor`, `selectedColor`, `textColor`, `selectedTextColor`, `iconColor`, `selectedIconColor`, `radius`, `padding` |
| `menu`³ | `backgroundColor`, `textColor`, `radius`, `borderColor`, `borderWidth`, `elevation`, `shadowColor`, `surfaceTintColor` |
| `tooltip`³ | `backgroundColor`, `textColor`, `radius`, `borderColor`, `borderWidth`, `padding` |
| `toast`³ | `backgroundColor`, `textColor`, `radius`, `borderColor`, `borderWidth`, `elevation` |
| `switch`³ | `thumbColor`, `trackColor`, `trackOutlineColor`, `selectedThumbColor`, `selectedTrackColor`, `selectedTrackOutlineColor` |
| `slider`³ | `activeTrackColor`, `inactiveTrackColor`, `thumbColor`, `overlayColor`, `trackHeight` |
| `progress`³ | `color`, `trackColor`, `thickness`, `radius` |
| `badge`³ | `backgroundColor`, `textColor`, `smallSize`, `largeSize` |
| `chip`³ | `backgroundColor`, `selectedColor`, `textColor`, `radius`, `borderColor`, `borderWidth`, `padding` |
| `divider`³ | `color`, `thickness` |
| `scrollbar`³ | `thumbColor`, `trackColor`, `radius`, `thickness` |

³ Schema 3.

Radii are 0–40, border widths 0–8, elevations 0–24, sizes (`minHeight`,
`height`, `iconSize`, badge sizes) 0–96, thicknesses (`thickness`,
`trackHeight`) 0–16. Insets (`padding`, `margin`, `insetPadding`) are four
numbers `[left, top, right, bottom]`, each 0–64. Numbers must be finite.
`filled` is a boolean. Fonts remain separate settings.

`button` styles the primary buttons: Material elevated and filled buttons, and
Btn.elevated. Text buttons (and Btn.text), outlined buttons and icon buttons
keep the app's style unless `textButton`, `outlinedButton` or `iconButton` says
otherwise, so a filled primary button does not turn every text action into one.

`search` styles the search fields that draw their own pill: the settings
search, the server switcher and the search in a list's bar. The text field
inside the pill never takes `input`'s border or fill. `segmented` covers
segmented buttons and the app's segmented tabs; `sidebar` the rows of the side
bar and the settings menu; `toast` toasts and snack bars; `menu` popup and
context menus; `divider` dividers and hairlines; `badge` also the navigation
rail's count badges.

The state tables (`[components.button.hovered]`, `.pressed`, `.focused`,
`.selected`, `.disabled`) exist on `button`, `textButton`, `outlinedButton` and
`iconButton`, and accept the same fields as their base table.
State tables merge across common and brightness-specific configuration.
For each property, priority is disabled > pressed > hovered > focused > selected
> base. Unspecified properties inherit the existing button theme and Flutter defaults.

These styles apply to Material components. The custom NavigationRail also uses
navigation colors and indicator shape; CardX honors card shape and elevation;
Input honors input borders and padding; SideBarTile honors `sidebar`, then tile colors and borders,
while retaining its compact spacing. Btn.elevated honors the button style;
compact Btn rows/columns retain their layout and use the themed radius.
Explicit per-widget overrides still take priority. Theme preview uses these
same settings in memory; dismissing the picker restores the previous appearance.

### Layout

Schema 3. `[layout]` holds app-wide settings that are not a component:

```toml
[layout]
# "compact", "standard" or "comfortable" spacing of Material controls.
# Omitted keeps the platform's default.
density = "compact"
```

## Splash screen

`splash` covers the app with a color and an optional logo while it takes its
first frames, then fades out. It is absent unless the table is present, since
otherwise every package would carry one.

```toml
[splash]
color = "surface"          # any palette role, or an ARGB integer
logo = "splash_logo.svg"   # optional, one fixed name at the archive root
duration = 900             # milliseconds, 100–3000, default 600
```

The logo is one file named `splash_logo.png`, `splash_logo.jpg`,
`splash_logo.jpeg` or `splash_logo.svg` at the archive root — a name, not a
path. A PNG or JPEG is at most 2048 × 2048 pixels and 512 KiB, an SVG 512 KiB
and the same document checks as an icon. It is drawn at 96 logical pixels,
centered, in its own colors: unlike an icon, it is not tinted. In an SVG,
`currentColor` is the palette's `onSurface`, so a logo can mix fixed colors with
one that follows the theme.

`duration` is how long the splash stays up before it fades, and what it delays
is the launch, which is why the ceiling is low. It is read once, when the app
builds its first frame: choosing another theme later does not play a splash
again, and a package selected during a launch does not play its own.

Only this half can follow a theme. What the operating system draws before Dart
starts — an Android window background or an iOS launch storyboard — is decided
when the app is built and can only change with the system's brightness.

## Image keys and limits

Supported icon keys are `tab.<tab>` and `tab.<tab>.selected` for `server`, `ssh`,
`file`, `snippet`, `agent`, `benchmark`, `remoteDesktop`, `virt`, `workspace`, and
`monitor`. Navigation keys
are `nav.more`, `nav.settings`, `nav.tune`, `nav.privacy`, `nav.agent`,
`nav.tabs`, `nav.server`, `nav.sort`, `nav.terminal`, `nav.folder`, `nav.cloud`,
`nav.snippet`, `nav.inbox`, `nav.key`, `nav.info`, `nav.download`, and
`nav.desktop`. The Files window also draws `file.dir`, `file.link`,
`file.default`, and `file.<ext>` for a file's extension (`file.py`,
`file.rs`, `file.gitignore`). A name whose extension the package does not
carry falls back to a related key when there is one (`file.css` for
`.scss`, `file.sh` for `.bash`), then to `file.default`, then to the
built-in glyph. A package may carry at most 128 icon keys. More than 48
requires `min = 4` (see Schema versions); the remaining keys can cover tabs,
navigation and common file extensions.

These are the keys ServerBox draws. The format is shared with other apps built
on the same library, so a key made for one of them — dotted lowercase words,
such as `tab.chat` — is accepted and kept, and ServerBox does not draw it. A
key that is not well formed is rejected. The editor schema lists the tab and
nav keys and the Files-window keys this app draws, each bound to
`icons/<key with dots as underscores>.png` or `.svg`. The installer still
accepts any other well-formed `file.*` key, with the same file name.

The compressed archive and total extracted content are each limited to 16 MiB.
`manifest.toml` is limited to 64 KiB. An icon is limited to 256 KiB, the splash
logo to 512 KiB, and the background to 8 MiB, 8192 pixels on either side, and 64
megapixels. The installer checks every image — decoding a PNG or JPEG, reading
an SVG as a document — before writing an isolated, content-addressed
installation directory.

## Variants

Schema 3. One package can carry several themes, such as Pride's Trans,
Nonbinary and Rainbow. The package installs and updates once, as one version.
The preset picker offers each variant as a theme of its own
(`Pride · Trans`), and the store and the website show the package once with a
segment per variant.

Everything outside `[variants]` is what the variants share. Each
`[variants.<key>]` table has a `name` and any of `colors`, `icons`,
`background`, `splash`, `shapes`, `components` and `layout`, drawn over the
shared tables: a table merges key by key, and any other value replaces the
shared one. Keys are lowercase letters, digits, `-` and `_`; at most 8.

```toml
[background]
type = "image"
image = "background.png"
opacity = 0.12

[variants.trans]
name = "Trans"

[variants.trans.colors.palette.light]
primary = 0xFF1F74A8

[variants.trans.background]
tile = 120
```

A file in `variants/<key>/` replaces the package's file of the same name for
that variant: `variants/trans/background.png` is the Trans variant's
`background.png`, and a variant without one uses the package's. Only
backgrounds and splash logos can be replaced this way. Icon files are shared,
so a variant may set `icons.style` and `icons.colors` but not `icons.images`.
The installer checks every variant as a complete theme and refuses a file
that no variant uses. The first variant is the one a new install applies.

## Icon packs

An icon pack is a package of icons only, chosen apart from the theme and drawn
over whichever theme is in use, like a VS Code file icon theme. Its manifest
says `kind = "icons"` and needs schema 4:

```toml
id = "yourname.devicons"
name = "Devicons"
kind = "icons"

[schema]
min = 4
max = 4

[icons.images]
"file.py" = "icons/file_py.svg"
"file.rs" = "icons/file_rs.svg"
"tab.server" = "icons/tab_server.svg"

[icons.colors]
"tab.server" = "primary"
```

It carries `format`, `schema`, `id`, `name`, `kind` and `[icons]` with `images`
and `colors`, and nothing else: no `modes`, colors, shapes, components,
background or splash, and no `icons.style`, which stays the theme's. Its keys,
file names and limits are a theme's. A role in `icons.colors` is resolved
against the theme in use.

A key the pack carries is drawn from the pack, whatever the theme carries for
it; a key it does not carry is the theme's, then the built-in glyph. In the app
a pack is chosen in **Settings → Appearance → Icon pack**, or by tapping it in
the theme store's **Icon packs** tab; **Theme's icons** goes back to the
theme's own. A backup carries the installed packs and which one is chosen.

## Theme store

The store reads two levels. A **catalog** is a TOML file that lists
repositories without naming themes or versions. Each **repository** is a git
repository containing one TOML file per theme.

Open **Settings → Appearance → Theme store** to view one list combining themes
offered by the catalog and themes installed on this device. Each theme appears
once. Tap an uninstalled theme to install and apply it; tap an installed theme
to apply it. Use the trailing button to install or remove a theme, as
appropriate. Removing the active theme returns the app to its default theme.

The listing is cached between runs, so the page can show its previous contents
immediately. The caption below the app bar identifies the repositories and
when they were last read. Use the refresh button beside the caption to read the
catalog again. Versions this build cannot read remain listed with an
explanation, so users can still see that the theme exists.

```toml
schema = 1
name = "ServerBox themes"

[[repo]]
url = "https://serverbox.lollipopkit.com/store.tar.gz"
```

Repository URLs must use HTTPS and point to either a git repository or a
tarball. Git repositories are fetched from
`<address>/archive/HEAD.tar.gz`, which uses the repository's default branch
without assuming its name.

The bundled catalog lists the official repository, which is the
[`store/`](https://github.com/lollipopkit/flutter_server_box/tree/main/store)
folder of this repository served as a tarball by the website. To offer an
official theme, see [Themes](/docs/development/themes/#official-themes).

### A theme repository

`repo.toml` identifies the repository and its schema. Each theme has a file
under `themes/`, and each icon pack one under `icons/`, named after its `id`;
files whose paths do not match their IDs are rejected. An icon pack's listing
is written like a theme's.

```toml
schema = 1
name = "Somebody's themes"
```

```toml
# themes/amethyst.toml
id = "amethyst"
name = "Amethyst"
description = "A purple palette"
homepage = "https://example.org/amethyst"
license = "MIT"

[[version]]
version = "1.2.0"
schema_min = 1
schema_max = 1
url = "https://github.com/example/themes/releases/download/amethyst-1.2.0/amethyst.fsbt"
sha256 = "0000000000000000000000000000000000000000000000000000000000000000"
size = 40960

[[version]]
version = "1.1.0"
schema_min = 1
schema_max = 1
path = "packages/amethyst-1.1.0.fsbt"
sha256 = "1111111111111111111111111111111111111111111111111111111111111111"
```

`description` is a string, shown as it is in every language, or a table of
language tags. The store looks a table up by the app's language: the full tag
(`zh-TW`), then the language alone (`zh`), then `en`, then the first entry.
Tags may be written with `-` or `_`.

```toml
[description]
en = "A purple palette"
zh = "紫色调色板"
zh-TW = "紫色調色盤"
```

Each version specifies either `url`, pointing to its release, or `path`, naming
a `.fsbt` file in the repository tree. The store requires `sha256` to install
the package. `size` is used to show the download size before installation.

`schema_min` and `schema_max` declare the package's manifest schema range. This
allows one repository to serve apps with different supported versions: **the
app installs the newest version it can read**, which may not be the newest
version listed. Themes with only newer, unreadable versions remain listed with
an explanation. Versions using schema 2 features must set `schema_min = 2`;
setting it to 1 could offer older apps a package that installs but silently
loses its icon, color, or splash screen. Versions using schema 3 components or
`[layout]` must set `schema_min = 3`, and versions with more than 48 icons
`schema_min = 4`.

A third-party theme is released from its author's own repository; only official
themes are released from this one. The serverbox-theme skill's
`scripts/publish.py` does it the way the official themes are published: it
detects which themes changed, uploads their packages to one pre-release of the
author's repository (never its Latest) and appends the versions to the
listings. A package can also be hosted anywhere else that serves it over
HTTPS. The listing's `sha256` is what binds
the address to the bytes: the store installs nothing without one, and nothing
whose digest does not match. To add a repository to the app's catalog, open a
pull request to this repository that adds a `[[repo]]` entry.

Repositories may contain a `plugins/` section alongside `themes/` and
`icons/`. This build reads themes and icon packs and skips that section without
rejecting the repository.

Direct URL installation accepts HTTPS `.fsbt` links without a store. The
installer follows at most three HTTPS redirects and does not send credentials.
Catalog and repository tree size limits are documented in
[Themes](/docs/development/themes/#theme-store).

## Theme sources

The official One Dark Pro theme in the theme store adapts the UI palette of
this VS Code theme to Material surfaces, selection states, cards and buttons.
It is an independent adaptation, not a VS Code extension bundle. The official
Devicons icon pack uses [Devicon](https://github.com/devicons/devicon)'s
language and tool logos (MIT) to identify file types; those products and logos
are their owners' trademarks. The official VS Code theme adapts VS Code's own
Dark Modern and Light Modern workbench colors to ServerBox. Fonts and terminal/editor
color settings remain separate.
AMOLED is an original ServerBox palette. It uses black surfaces in dark mode
and generated colors in light mode, allowing System appearance.

Muted text colors are adjusted where needed to keep normal text at a contrast
ratio of at least 4.5:1.

<details>
<summary>Upstream attribution</summary>

**VS Code**

Source: [VS Code theme defaults](https://github.com/microsoft/vscode/tree/main/extensions/theme-defaults) (Dark Modern, Light Modern)

The MIT License (MIT)

Copyright (c) 2015 - present Microsoft Corporation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

**One Dark Pro**

Source: [One Dark Pro](https://github.com/Binaryify/OneDark-Pro)

The MIT License (MIT)

Copyright (c) 2013-2022 Binaryify

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

**Devicon**

Source: [Devicon](https://github.com/devicons/devicon)

The MIT License (MIT)

Copyright (c) 2015 konpa

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

</details>

---

### Src Content Docs Development Themes (`docs/src/content/docs/development/themes.md`)

---
title: Themes
description: How the built-in themes are packaged, loaded and distributed
---

This document covers the built-in themes in this repository. For the package
format and publishing instructions, see
[Theme Package Authoring](/docs/development/theme-authoring/). For the
user-facing guide to choosing and installing themes, see
[Themes](/docs/advanced/theme-packages/). Upstream palette sources and their
attributions are listed in the authoring guide.

## Built-in themes

`BuiltinTheme` (`packages/fl_lib/lib/src/theme/builtin.dart`) lists the packages
bundled with this build: only what the app needs without a network. `Default`
is a Dart constant and does not read an asset; its picker label is localized
(fl_lib `defaultLabel`). The AMOLED theme source is in
`packages/fl_lib/assets/themes/amoled/`, with a `manifest.toml` registered in
fl_lib's `pubspec.yaml`. Every other official theme is in
the theme store (see [Official themes](#official-themes)); a saved preset that
names a bundled theme this build no longer carries falls back to Default
(`ThemePackages.reconcileSelection`).

Bundled folders use the same installer as imported folders and `.fsbt`
archives, so built-in themes support the same fields as installed themes. The
folders are committed as source and bundled directly by Flutter; no archive or
other binary asset is committed for them.

A new official theme goes to the store, not here. Bundle one only if the app
must have it offline, by creating its folder, registering it in fl_lib's `pubspec.yaml`,
and adding a `BuiltinTheme` case.

## Loading

`BuiltinThemeLoader` (`packages/fl_lib/lib/src/theme/package.dart`) loads themes on
demand. `_loaded` stores completed results and `_pending` tracks active loads,
so simultaneous requests for the same theme share one parse. Failed loads are
not cached and can be retried.

Opening the picker does not load theme files. A folder is read when selected or
at startup if it was the saved selection. Built-in assets use a separate
runtime cache and do not appear in the user-installed theme list.

## The parser and the editor schema

Three files in `packages/fl_lib/lib/src/theme/` define the manifest grammar:
`package.dart` (top-level tables, archive entries, the schema range),
`components.dart` (component fields, states, and every numeric range) and
`palette.dart` (the non-deprecated ColorScheme roles).
`docs/schemas/fsbt-manifest.schema.json` mirrors these definitions so editors
can report errors while a file is being edited. The schema is derived from the
parser definitions, not from this documentation.

The schema is as strict as the installer except for one rule it cannot express:
the installer rejects an `icons.colors` key without a matching `icons.images`
entry. This check spans two tables and cannot be represented in JSON Schema.

The CI `docs` job validates every checked-in manifest, including the bundled
folders and `docs/examples/aurora/`, against the schema.
`test/unit/theme_schema_test.dart` checks the schema against the parser, so the
fields, enums, and bounds offered by editors match what the installer accepts.

## Theme store

`ThemeRepo` (`packages/fl_lib/lib/src/theme/repo.dart`) reads a catalog of repositories
and then each repository's tree. `assets/catalog/repos.toml` provides the
initial catalog when no network is available. When `Urls.themeCatalog`
responds, the app reads that catalog instead.

Repository URLs must use HTTPS and resolve to a tarball. Git repositories are
fetched from `<address>/archive/HEAD.tar.gz`, which follows the repository's
default branch without assuming its name. `ThemePackages.download` rejects URLs
containing credentials and follows at most three redirects, checking that each
target still uses HTTPS. Plain HTTP is rejected because the repository
determines which bytes are installed.

`ThemeRepo` enforces these limits: at most 100 repositories and 1 MiB per
catalog; 16 MiB compressed and 64 MiB unpacked per repository tree; and 8 MiB
per entry. Unknown sections are skipped, allowing one tree to contain both
`themes/` and `plugins/` for the app and plugin feature.

The store page is in `packages/fl_lib/lib/src/theme/view/store/`. Its listing is persisted
between runs in `SettingStore.themeStoreCache` using `ThemeStore.toJson()` with
`updateLastModified: false`. The key is included in
`SettingStore.deviceLocalKeys` because this cache records catalog contents; it
is not user data to sync or restore on another device. Cached items do not
include repository files (`ThemeStoreItem.index` is null), so installing a
version stored in a repository fetches its tarball again. The digest is checked
in either case.

A listing's `description` is a string or a table of language tags
(`ThemeText`); the page resolves it with the app's locale, and the cache keeps
the table. A row's preview (`packages/fl_lib/lib/src/theme/view/store/preview.dart`)
is built only while the row is expanded. It renders real widgets under the
`ThemeData` that `buildAppTheme` (`packages/fl_lib/lib/src/theme/view/app_theme.dart`)
makes from the package, the same function the app uses for itself with
`AppThemeSource.current()`. An uninstalled theme is installed for the preview
under `<app name>_theme_preview` in the system's temporary directory, apart
from the user's themes, and that directory is deleted when the page is
disposed.

A package with `[variants]` installs once; each variant is written as a
complete, normalized theme directory under `variants/<key>/` of the
installation, so `ThemePackages.installed(id, variant: key)` reads it with the
same code as a package without variants. The preset carries the variant as
`package:<installation id>#<key>`; `appThemePackage` keeps the installation id
alone.

## Store themes are not bundled

No store theme ships inside the app: a `.fsbt` in the repository is a binary
git cannot diff. A backup made while one did (`bundled` in
`ThemeBackup`) is restored from the store, by the release whose digest is the
installation id.

## Official themes

Official themes live in `store/` in this repository: `store/repo.toml`, and
for each theme a listing `store/themes/<id>.toml` beside its source folder
`store/themes/<id>/`, and for each icon pack the same under `store/icons/`.
`test/unit/theme_store_tree_test.dart` checks this folder
with the store's reader. A rejected listing fails the test instead of silently
disappearing from the store.

The app does not download this repository. The website build runs
`scripts/store-tarball.sh`, which packs `store/` as committed at `HEAD` into
`public/store.tar.gz`, and the catalog lists
`https://serverbox.lollipopkit.com/store.tar.gz`. A change to `store/` reaches
the store when the website is deployed: the Cloudflare Pages project builds on
changes under `store/` as well as `website/` and `docs/`. The same build lists
the themes on the site (`website/store-data.js`). Images and theme packages
are Git LFS objects, and `git archive` would write their pointers, so the
script packs the working tree: it refuses a `store/` that differs from `HEAD`
or still holds pointers, and writes the archive with Python's `tarfile`
(sorted, no xattr records, which macOS `tar` adds and the reader refuses).

`scripts/publish-themes.py` publishes every theme that changed since its newest
recorded version, in one run. It runs the serverbox-theme skill's
`scripts/publish.py` with `store/` as the theme repository — the same publisher
a third-party author runs in their own repository, where their themes are
released; only official themes are released from this repository. It packs each folder and compares the package's
digest with the newest version in the listing: the same digest means nothing
changed, and the theme is skipped. A changed theme gets the next patch version
(`--bump minor|major` for another part, `<id>=<version>` for an exact one, 1.0.0
for a theme with no version yet). `--dry-run` shows the plan; naming ids limits
the run to those themes.

The package is deterministic, so its digest reflects file contents alone:
entries are sorted, timestamps and permissions are fixed, and files are stored
without compression. Checkout modification times and the machine's zlib do not
affect the result.

All new packages are uploaded together, as `<id>-<version>.fsbt`, to one
release of this repository tagged `themes`; then each listing gets a
`[[version]]` block with the digest and size, and the listings are committed
afterwards. One release holds every package: the app's update check reads this
repository's releases, a tag without a build number is skipped there, and a
release per theme version would push the app's releases off the first page. The
release is a pre-release, created with `--latest=false`, and is never this
repository's Latest: GitHub does not mark a pre-release Latest, so Latest is
always an app release, and the script checks that before it uploads anything.

The script keeps two ordering and integrity rules. It uploads packages before
updating the listings, so a listing never points to a missing asset. It never
replaces an uploaded asset — one left by an interrupted run is accepted only if
its bytes are the same — and never records a version number for a second set of
bytes.

---

### Src Content Docs Zh Changelog (`docs/src/content/docs/zh/changelog.mdx`)

---
title: 更新日志
description: 各发布版本的变更内容
---

## v1.0.1986 — 2026-12-01

### 新增

- **状态标签页**：服务器标签页改为状态标签页，同时列出服务器和独立 BMC，支持搜索、排序和批量选择，自动密度按窗口能完整显示的卡片数调整。
- **独立 BMC**：可单独添加不关联服务器的 BMC，在卡片上查看电源、健康状态和传感器读数并直接开机，备份与分享中一并保留。
- **每台服务器可选多个 SSH 密钥**，按设定顺序尝试；某个密钥无法加载时不再中断其余密钥，之后仍可回退到密码或 Agent 认证。
- **Linux 新增 `.deb`、`.rpm` 和便携版 `.tar.gz`** 下载，Windows 可通过 Scoop 安装。
- 主题商店新增 Gruvbox 主题。
- 服务器设置新增最大连接重试次数。

### 变更

- 重新整理备份与同步设置页。
- 容器统计新增网络与磁盘 I/O 总量；无法获取的值显示为不可用，不再显示为 0。
- 升级至 Flutter 3.50.1。

### 修复

- 修复 WebDAV 配置失败后无法再编辑或删除的问题；配置失败时不会开启自动同步。
- 开启旧算法后，可连接仅接受 SHA-1 `ssh-rsa` 签名的服务器。
- 修复 Windows 服务器命令输出的编码问题，并支持处理 `sudo` 密码提示。
- 应用切换器的隐私模糊设置改为仅本机生效，不再随备份恢复或同步改变。
- BMC 在确认电源操作期间被删除时，该操作会被取消。
- 修复桌面端导出数据、保存海报时的文件夹选择，以及全屏和托盘关闭行为。

## v1.0.1962 — 2026-11-23

### 新增

- **App 与 Monitor 的 MCP 服务**：App 内置本地 MCP 服务器，可对外提供主机与设置能力；Monitor 新增带 API Token 认证及按 IP / Token 限流的 MCP 端点。
- **扩展 BMC（Redfish）管理**：支持读取与清空事件日志、查看硬盘列表与故障预测状态、设置启动项覆盖、挂载与弹出虚拟介质，以及开关定位指示灯。
- **SSH Agent 与跳板机连接复用**：支持使用本机 `ssh-agent` 密钥认证、向终端会话转发 SSH Agent，以及通过跳板机已有的 OpenSSH ControlMaster 建立连接。
- **Agent 敏感信息脱敏**：在 Agent 将上下文发送给模型前，自动脱敏密钥、Token 和密码等敏感信息。
- **Monitor 备用地址与分设备历史指标**：支持为 Monitor 连接配置备用地址，并按自定义时间范围查询各设备的历史指标。
- **服务器状态分享与 Swap 分区详情**：支持将服务器状态生成海报图片或文本分享；展示每个 Swap 分区的大小、占用与优先级。

### 变更

- **macOS 统一为非沙盒版本**：停止 Mac App Store 沙盒版构建并移除相关分支与提示。
- **iOS 本地 Linux 环境**迁移至新的用户态引擎（`iul`）。
- **交互统一与优化**：全应用弹窗统一为底部面板；各处改用支持搜索、标签筛选和排序的统一服务器选择器；底部导航栏按窗口宽度自适应显示标签数量。
- **Agent 对话**：折叠展示工具调用，并优化流式输出时的滚动跟随。
- 增强本地数据库向前兼容能力：旧版本可打开其能识别的新 schema 数据库。
- 升级至 Flutter 3.50。

### 修复

- 支持从 `hwmon` 读取 CPU 温度，不再仅依赖 thermal zones。
- 修复断连后 Agent 回复丢失的问题，并在 iOS 上申请后台时间以完成回复。
- 修复 Redfish 重复返回同一虚拟介质槽位时界面显示重复项的问题。
- 修复非正方形发行版图标导致列表标题未对齐的问题。
- 避免后台同步与关闭连接阻塞页面退出。
- 修复路由切换时主题背景闪烁或消失的问题。
- 修复终端屏幕常亮未遵循设置的问题。

## v1.0.1925 — 2026-11-11

### 升级前须知

- **移除使用情况统计**与“完整”诊断级别。原设为“完整”的安装会自动改为“基础”，仅上传错误和崩溃信息。
- **Monitor v0.4.0 改为单账户，仅使用密码登录。** 登录后即拥有 Monitor 运行所用系统账户的权限；角色、按功能细分的权限、文件根目录和只读模式均已移除。升级时保留最早创建的管理员账户，其余账户的任务、记忆和桌面数据并入该账户。App 不再要求输入用户名；连接早于 v0.4.0 的 Monitor 时，会先提示升级再登录。
- **Monitor 自签名证书改为按指纹一次性信任。** 移除“忽略证书”开关，改用 SHA-256 证书指纹绑定：首次连接时可在服务器卡片或详情页核对并信任证书，此后仅当证书变更时才再次提示。
- **同步改用增量加密格式。** iCloud 和 WebDAV 改为同步逐项变更而非整份备份，数据使用由备份密码保护的同步密钥加密。移除 GitHub Gist 和 Monitor 托管备份同步目标。共用同一同步目标的设备需设置相同的备份密码并全部升级至本版本，旧版本无法读取新版本写入的变更。
- **Monitor 面板的终端不再通过 SSH 登录**，而是直接以 Monitor 运行所用的系统账户打开本机 shell。
- 下文涉及 Monitor 面板的新功能、Monitor 标签页的管理视图及新增通知渠道均需配合 **Monitor v0.4.0** 使用。

### 新增

- **存储与文件共享**（App 与 Monitor 面板）：管理磁盘、分区、RAID 阵列、ZFS 存储池、LUKS 加密与 SMART 健康状态，并支持配置 SMB 共享（含 Time Machine 与回收站）和 NFS 导出。
- **Monitor 面板升级为多窗口桌面**：各项功能以独立窗口运行，提供菜单栏、Dock、Spotlight 搜索、通知中心、终端与文件的多标签页和分屏，以及自定义壁纸与主题。
- **Monitor 面板补全服务器管理工具**：进程、服务、计划任务、容器（镜像、日志、进入容器终端，以及数据卷和挂载目录的定时备份）、系统用户与用户组、代码片段、防火墙、跑分、tmux、iperf、文件编辑器、远程桌面（VNC、RDP）、虚拟化与 BMC（Redfish）。
- **自托管 Web 应用商店**：在 Monitor 面板中通过 Docker Compose 部署和更新 40 余款常用服务（如 Immich、Jellyfin、Nextcloud、Vaultwarden、Home Assistant、Gitea、Open WebUI、Grafana、n8n 等），支持自定义应用源与本地应用包，提供端口冲突检查、健康状态告警、共享媒体目录及内置反向代理访问。
- **Monitor 桌面应用（`.fsba`）**：支持安装运行在沙箱中、按授权权限隔离的第三方应用，并在应用商店提供官方签名应用包：**本地推理**（按本机 GPU 匹配 Ollama、llama.cpp、vLLM、SGLang 与 MLX）、**AI Agent 工具**（Codex、Claude Code、pi、opencode、Hermes、OpenClaw）、**反向代理与 WAF**（nginx、Caddy、Traefik 及 ModSecurity + OWASP CRS）、**Tailscale**、**内核管理**、**Ubuntu Pro** 与 **系统清理**。
- **Monitor Agent 模式及客户端协同**：在 Linux、macOS 和 Windows 服务器上直接运行 AI 运维任务，支持按任务选择模型、思考深度与权限模式，提供执行计划、命令风险检查、sudo 提权确认、文件附件、记忆、MCP 服务器（含 OAuth 登录及已部署应用的 MCP）和技能扩展；也可在 App 的 Agent 标签页中直接发起、实时跟进和回复服务器上的任务。
- **Agent 命令权限控制**：提供手动、自动和全部允许三种模式，可配置允许、询问或拒绝特定命令的规则，同时适用于本机 Agent 与服务器上的 Monitor Agent 模式。
- **Monitor 标签页、在线升级与设置备份**：集中查看所有已连接 Monitor 的版本状态并支持一键升级，查看正在触发的告警规则、通知、已部署的 Web 应用（有可用更新的排在前面，可通过 Monitor 代理直接在浏览器打开），以及每台服务器的审计日志和已登录会话与受信任设备（可随时结束或移除）。服务器详情页也会列出其已部署应用；Monitor 还支持将自身设置以 `age` 加密归档备份至 WebDAV。
- **ServerBox OS（`sbOS`）可引导系统镜像**：基于 Alpine Linux（`musl`）和 Debian 13（`GNU`）构建，支持 `x64`（BIOS 与 UEFI）和 `arm64`（UEFI），预装 Monitor 与 Docker，可在内存 Live 模式下直接运行或写入磁盘安装。
- **服务器自动发现**：从局域网、SSH 配置文件、Tailscale 和 Cloudflare Tunnel 中查找 SSH 服务器，并连同跳板机一并添加；首次启动引导流程也围绕此功能重新设计。
- **按类别选择同步内容**：设置、AI 偏好、凭据、密钥口令、文件和跑分记录可分别开启或关闭同步；字体、图片、技能、主题包和图标包现已纳入同步。重新设计的同步页面会展示各同步目标的实时状态。
- **Monitor 已登录设备免受异地失败登录锁定**：Monitor 通过下发的设备令牌识别曾成功登录的设备，其他来源的失败尝试不会将其锁定。
- **新增通知渠道**：支持 SMTP 邮件、Telegram、Discord 和 ntfy，并支持在 `config.toml` 中通过 `${ENV}` 引用环境变量配置推送凭据；Bark 新增副标题、Markdown、重要警告音量、角标、图片、复制、归档选项及 AES-CBC 加密推送。
- 通过 Monitor 连接的服务器支持查看 **GPU 进程**。
- **iOS**：设备文件与已安装的 Linux 环境接入系统“文件”App；终端中通过系统菜单粘贴时按括号粘贴模式发送。
- **Windows 安装程序（`.exe`）**：无需管理员权限即可为当前用户安装，内置 Visual C++ 运行库，并支持通过 WinGet 安装；便携版 `.zip` 压缩包继续提供。
- **tmux**：支持缩放窗格，切换窗格时保持缩放状态。
- **全新服务器全屏视图**：覆盖全平台，可切换展示单台或全部服务器，并内置防烧屏保护。

### 变更

- 导出的备份文件改用 `age` 格式，可直接使用 `age -d` 命令配合备份密码解密；旧格式备份仍可恢复。Monitor 上保存的凭据和 Agent 模式对话现已加密落盘。
- 关闭重开 App 后不再自动恢复上次打开的终端和文件标签页。
- 优化终端中的鼠标滚轮与触控板滚动：滚轮按整行滚动，触控板可在全屏终端程序内顺畅滚动，并合并重复滚动条。
- 通知渠道编辑器现在会展示该渠道支持的全部配置项，包括尚未填写的字段。
- 百分比图表的纵轴上限不再超过 100%。
- 补全并润色 App、Monitor 面板与文档中所有支持语言的翻译。

### 修复

- macOS：Intel 版 DMG 改用 Skia 渲染器，修复 Intel Mac 上文字显示错乱的问题（#1798）。
- 数据库：修复打开旧版本数据库（schema v31 之前）时的迁移失败问题；Windows 上打开数据库遇到暂时性 I/O 错误时会自动重试。
- tmux：修复窗格与窗口目标解析、跨窗口切换、安全分离、切换窗格时的实时画面跟随，以及断线重连后的输出回放问题。
- 终端：修复快速输入时字符重复、从选择器打开会话后未切换到对应标签页、更换终端背景图片后不立即生效的问题；从终端打开文件页时无需向终端输入探测命令即可定位当前目录。
- 编辑器：修复开启输入法时复制大段选中文本会丢行的问题。
- 设置与导航：离开含有未保存修改的设置页前会提示确认；在多标签页、工作区分屏和宽窗口布局下，返回操作均能回到当前可见页面。
- 对话框打开期间调整窗口大小或旋转屏幕后，对话框按钮仍可正常点击。
- 移动端：修复 iOS 文本框与终端中的粘贴问题，合并前台保活会话通知，并修复切换视图时的键盘反复弹起问题。
- 当服务器仅支持标准 RDP 安全层时，远程桌面会给出明确说明。
- Monitor：修复 Linux 构建在不支持 AVX 指令集的 CPU 上无法启动的问题；驱动未上报单进程显存占用时（Windows、WSL）仍正常列出 NVIDIA GPU 进程；通知渠道报错信息不再暴露可能含 token 的请求 URL；新安装的 Monitor 不再向空白占位渠道发送告警。

## v1.0.1856 — 2026-11-01

### 新增

- **服务器详情列出所有 Linux 块设备**：磁盘对话框列出全部磁盘和分区，包括未挂载和空白磁盘，显示型号、
  容量、类型、传输方式和文件系统。Monitor 面板也会显示这些设备（v0.3.0）。
- **Android**：重新设计的主屏幕 Widget，可调整大小，尺寸越大显示越多；可将服务器添加为主屏幕快捷方式；
  会话的快捷设置磁贴；从其他应用分享文本和文件到代码片段或服务器；键盘快捷键；Live Updates；在系统设置中
  单独设置应用语言；启动器中的 Widget 预览。
- **在仅 Monitor 的服务器和本机上编辑文件**，与 SSH 服务器一样。文件打开期间若服务器上的文件发生变化，保存时会先询问是否覆盖。
- 新增波斯语（فارسی），这是第一个从右到左书写的语言。

### 变更

- AI 设置移至设置顶层。
- 关于页和 macOS 菜单中移除 Wiki 链接。
- 修订所有语言的翻译，包括 Android Widget、应用商店描述、Monitor 面板和官网。
- Monitor v0.3.0 使用 ntex 4。

### 修复

- 修复编辑器在输入法下的全选和光标跨行移动问题。
- 设置子页面不再显示“清除所有设置”按钮，避免误触后重置语言和首次引导。
- WebDAV 恢复不再因文件名包含 `%` 而失败。
- Android 不再将主动停止会话视为连接断开。
- Windows 上的 Monitor v0.3.0 不再于以服务或 SSH 启动约 20 秒后崩溃；命令超时后，其子进程也会一并结束。

## v1.0.1844 — 2026-10-30

### 新增

- **SSH 主机证书**：可连接仅提供主机证书的服务器，并在“设置 → SSH”中按主机模式
  信任主机证书颁发机构，与 OpenSSH 的 `@cert-authority` 规则相同。
- **记住加密私钥的口令**：口令保存在本设备的系统钥匙串中，重启后无需再次输入；私钥本身仍保持
  加密，备份中也是。私钥编辑页在通过应用锁验证后可以显示已保存的口令。可在 设置 → SSH 中关闭。
- Agent：对话可以包含当前屏幕上的内容，例如所选服务器的状态、容器、进程、服务、终端或文件视图。

### 变更

- 使用 AES-GCM 的 SSH 连接更快，包括文件传输。
- 终端、文件和远程桌面中的选择列表标签统一改为“选择”，不再显示成按钮。
- BMC：电源操作进行中会显示状态，并阻止重复操作；BMC 和虚拟化设置在地址变更时会重新要求输入密码。

### 修复

- 全屏终端程序中的文本选择会根据程序是否使用鼠标来决定行为。
- 修复终端长按菜单无法显示的问题。
- 重连失败不再关闭服务器状态所用的连接。
- BMC：打开后的第一次状态读取可以正常工作，刷新时保留已发现的系统信息。
- 存储密钥丢失或被系统密钥库拒绝、导致无法读取数据时，App 会说明原因，并提供重试或不带数据启动的选项，
  不再无法启动；该页面还会提示 root 过的 Android 设备上的密钥库模块。
- Monitor：russh 升级到 0.64.1，修复一个安全公告。

## v1.0.1816 — 2026-10-20

### 新增

- **图标包**：图标可以独立于主题选择；文件窗口的图标可由主题定制，按文件扩展名匹配。
- **Markdown 预览**：文件编辑器中的 Markdown 文件以渲染后的形式打开，点击编辑按钮查看源码。
- **终端重连按钮**：用于连接看似正常但已无响应的情况。
- **系统用户组**：在 App 和 Monitor 面板中，与系统用户并列显示。
- **屏幕阅读器支持**：终端内容可由屏幕阅读器朗读，benchmark 日志以文本呈现，图标按钮提供
  可供屏幕阅读器读取的名称；Monitor 面板支持键盘和屏幕阅读器操作。面板终端的朗读模式需手动开启。
- App 与 Monitor agent 会检查双方的协议版本，不一致时提示需要更新哪一方。

### 变更

- 编辑器默认隐藏已保存的私钥，通过应用锁验证后才可显示。
- Agent：思考等级随所选模型变化，收藏和输入框会显示模型来自哪个提供商。

### 修复

- 远程桌面：连接 KDE Plasma 自带的 RDP 服务（krdp）时，登录后不再立即断开；连接 xrdp 时直接使用已保存的密码登录，不再显示 xrdp 自己的登录界面。
- 服务器详情：超过六行的卡片（传感器、GPU、电池、BMC、自定义命令、磁盘健康）可以显示全部行。
- 状态脚本无法放入 `/tmp` 时，用户主目录下的备用目录现在可以正常工作；内存读取失败时会显示具体原因，不再显示“1024 B 中的 100%”。
- Monitor：在非英文系统语言的机器上也能读取磁盘。
- 启动失败时显示原因，不再没有窗口；首选项文件无法读取时不再导致无法启动。Windows 和 Linux 上首选项改为原子写入，写入中断不再损坏文件。

## v1.0.1787 — 2026-10-16

### 新增

- **终端下方的服务器状态**：可选状态栏，显示服务器的 CPU、内存、网络和磁盘；
  手机上显示在虚拟按键上方。可在**设置 → SSH**或终端标签页菜单中开启。

### 变更

- 底部面板可拖动调整大小；手机上的选择器改为面板形式；网络方向箭头移到数值前。
- 远程桌面更新为最新的 IronRDP 版本。

### 修复

- Android：通知栏现在显示应用图标，不再显示实心圆环。
- 很长的 Agent 会话可以再次打开；会话存入 SQLite 并分页加载。
- 终端：调整大小或滚动后出现的缓冲区空洞和残留行；虚拟按键的 Ctrl、Alt、Shift
  不再丢失按下状态。
- 桌面端：从托盘打开的设置显示在侧栏旁边，不再覆盖窗口；现在可以正常关闭。
- Windows：安装状态脚本时，退出状态在输出结束后才到达不再导致失败。
- 其中的 shell 尚未退出时，关闭工作区也不会报错。

## v1.0.1773 — 2026-10-13

### 新增

- **工作区标签页**：在分屏窗格中并排显示终端和其他服务器页面，支持同时向多个
  终端输入、保存布局和自定义快捷键。

### 变更

- 各页面的 Beta 功能标记方式统一。

### 修复

- Android：安装 Linux 系统时会保留硬链接和只读目录，临时文件存放在 `/tmp`。
- 应用在后台时断开的连接会被检测并重新连接，不再一直卡住。iOS 上，应用
  离开前台后文件传输还能继续运行一段时间。
- 终端中的 Agent 面板不再被键盘遮挡，并显示回复的生成状态。
- 在一个标签页中侧滑返回时，不再弹出另一个标签页中终端的键盘。
- 选择诊断级别之后才会上传诊断信息。

## v1.0.1765 — 2026-10-12

### 新增

- **防火墙管理**：支持 ufw 和 firewalld，可查看和编辑规则与区域；修改前会
  检查是否会导致 SSH 无法连接并给出提示。
- **终端程序状态**：在会话上显示进度（OSC 9;4）、命令开始与结束（OSC 133）
  和程序状态（OSC 7501），长时间运行的命令结束时可发送通知。
- **终端行高**设置；终端设置中显示当前使用的字体。
- 服务器页面在网速旁显示**网络流量**，可选择任意网卡；CPU 一栏显示线程数和
  各线程占用。
- 可按服务器设置是否将网络文件系统计入磁盘总量。

### 变更

- **窄屏标签页统一使用顶栏**，且顶栏会避开 iPadOS 窗口控制按钮。
- **各侧栏中的服务器条目样式统一**（服务器、终端、文件、远程桌面）：显示
  发行版图标和状态点；隐藏图标时显示左侧状态竖条。
- 首页图表加载更快。
- 磁盘信息同时读取 lsblk 和 df，各页面的磁盘列表和总量一致。
- 已用内存不再包含页缓存。
- ARM CPU 按厂商和型号命名，并列出所有核心类型。

### 修复

- 修复应用使用意大利语、韩语或阿塞拜疆语时无法启动的问题。
- 修复启动时打开的终端在服务器拒绝首次连接时加载失败的问题，现在会自动
  重试。
- 修复在其他标签页恢复的终端抢占焦点和键盘的问题。
- 停止 Agent 时会立即结束正在运行的命令。
- Agent 回复及其中的代码在所有平台均可选择。
- 修复远程桌面的键盘输入、长按和 VNC 密码问题。
- 备份中包含主题。
- 电池充满时不再报警；设备使用电池供电且电量低时会报警。
- 没有 `/etc/hostname` 的主机也能显示名称。

## v1.0.1719 — 2026-10-01

### 升级前须知

- **旧版 Agent 对话会被移除。** 新版 Agent 无法继续使用旧对话记录；这些记录
  原本也不包含在备份中。
- **部分设置已移除**，包括旧版 CPU 和网络显示选项、服务器历史记录、详情卡片
  排序、自定义主题目录地址，以及在系统 SSH 应用中打开终端。终端现在始终在
  ServerBox 中打开。
- **部分 Monitor 功能需要 agent 0.2.0**，包括账户与角色、端口转发、更长的
  历史记录和 Monitor 设置。升级后，现有账户会成为管理员，权限按旧访问设置转换。

### 新增

- **远程桌面：** 通过 SSH 或 Monitor agent 使用 RDP 或 VNC 连接服务器，无需将
  桌面端口暴露到网络。支持多个连接配置。密码保存为可选项；暂不支持音频、多显示器
  和文件传输。
- **虚拟化管理：** 管理 Proxmox VE 和 libvirt/KVM 虚拟机与容器，包括电源、控制台、
  快照、存储和网络。原有 Proxmox 设置会保留。
- **将本机作为服务器**，适用于 Linux、Windows 和 macOS DMG 版本，可查看状态、
  进程、服务和容器，也可使用终端和文件管理。
- **主题与主题商店：** 安装官方主题或导入 `.fsbt` 主题包。旧版 AMOLED 模式会
  转换为 AMOLED 主题。
- **端口转发**支持通过 Monitor agent 使用本地、远程和 SOCKS5 转发；SSH 也支持
  SOCKS5 转发。
- **在 App 中管理 Monitor 账户、角色和设置**，包括访问权限、数据采集、告警、
  数据保留和通知。
- **`serverbox://` 链接**可打开服务器、功能和代码片段，或预填新服务器。链接不含
  密码或密钥，运行代码片段前会要求确认。
- **Android 和 iOS 支持 ProxyCommand**；Android 文件选择器也可访问已安装 Linux
  系统中的文件。
- **更多监控数据**，包括 GPU、磁盘、网络、电池、传感器和 SMART 信息；通过 agent
  最多可查看 30 天历史记录。
- 另有 App 内 tmux 控件、减少动态效果、终端自动重连优化，以及旧版 SSH 服务器支持。

### 变更

- **服务器和设置页面采用新布局**，设置可搜索，服务器可搜索和排序，状态信息更清楚，
  手机导航也更简洁。
- **服务器连接更易管理：** 可分别启用 SSH 和 Monitor，并设置首选与备用连接。
- **Agent 换用新引擎**，支持选择 provider 和工具、分开保存全局与终端对话、附加图片，
  并可选择自动批准判定为安全的命令。
- **服务器管理页面得到改进**，涵盖容器、用户、进程、服务和计划任务。现在无需打开
  终端即可管理服务，查看进程和计划任务也更方便。
- 设备旧 Documents 目录中的文件会复制到新的 App 存储目录，原文件仍会保留。

### 修复

- 修复 Linux、Windows、macOS 和 BSD 上的进程控制与状态数据问题。
- 修复使用 fish 或 BusyBox 的服务器上的用户和计划任务页面问题。
- 修复备份恢复与导入问题，包括服务器重名和旧版密钥；重命名服务器后跑分记录会保留。
- 修复设置同步、服务器排序、SSH 连接清理，以及部分异常服务器响应导致的崩溃。
- 修复 Monitor agent 卡住，以及告警规则漏报或不运行的问题。

## v1.0.1617 — 2026-09-12

### 新增

- **macOS 按架构分别构建。** Apple silicon 使用
  `ServerBox-<版本>-arm64.dmg`，Intel 使用 `ServerBox-<版本>-amd64.dmg`。
  App Store 版本仅支持 Apple silicon。所有 macOS 版本的最低要求提高到
  macOS 13。
- **服务器用户与计划任务。** 服务器功能按钮新增两个入口。*Users* 可创建、
  修改和删除系统账户，包括 UID、主组与附加组、登录 shell、家目录和密码。
  *Scheduled tasks* 可读写 crontab，保留注释、环境变量和无法识别的行。
  两者都通过 `sudo` 执行，且仅支持 Linux 服务器。
- **实时活动开关**，位于 **设置 → 应用 → iOS → Live Activity**，默认关闭。
  此前每次终端连接都会出现实时活动，且无法关闭。
- 新增阿塞拜疆语（`az`）。

### 变更

- **Agent endpoint 的 API 版本由用户指定。** App 不再向未填写版本号的地址自动添加
  `v1`，此前这会导致智谱等 provider 的地址（如 `/api/paas/v4`）失效。升级时会将
  旧版自动补入的版本号写入已有配置，以保持原有设置可用。
- **较长的 Agent 对话改为摘要**，不再被丢弃。**设置 → 应用 → AI** 新增
  *Summarise at* 和 *Context size*，以及由 models.dev 提供的 *Model table*。
- **可允许明文 HTTP 的 AI endpoint**，位于
  **设置 → 应用 → AI → Allow plain HTTP**，用于局域网内自建的 Ollama 或
  vLLM。API key 和终端上下文会以明文发送；localhost 不受影响。
- 预发布更新开关改名为 *Receive pre-release updates*；原始 JSON 编辑器不再
  出现在 release 构建中。

### 修复

- **服务器分享二维码现在可以扫描。** 此前载荷未压缩，包含密钥的服务器会生成
  宽达 177 个模块的二维码，扫描器无法读取。现在会先 deflate 再加密，并降低纠错级别、
  限制二维码尺寸。
- **关闭应用锁需要身份验证。** 此前的校验未生效：无论验证是否成功，新值都会
  被写入，因此解除锁定不经过任何验证。
- **降级安装会给出处理方式。** 旧版本遇到更新版本写的数据时会在绘制界面前
  停止：没有窗口，没有提示，原因只在用户无法读取的日志里。现在会列出两个
  版本号，并提供加密备份、未加密导出和删除全部数据三个选项。
- **无法进行身份验证的设备不会再被锁在 App 外。** 将备份恢复到没有生物识别
  的硬件上时，锁屏没有可用的解锁方式，而设置里的开关在不可用设备上被隐藏，
  App 无法使用，能解决问题的控件也不存在。
- **一轮包含多个 Agent 工具调用不再中断对话。** 未回答的调用会导致工具结果
  多于 API 允许的数量，整个请求被拒绝。现在每个未执行的调用都会返回明确结果。
- Agent 的命令预览不再遮挡自身的 **Allow**/**Deny** 按钮。

## v1.0.1574 — 2026-09-06

### 新增

- **地球仪视图。** 点击服务器列表上方的地球仪按钮，可按服务器地址解析出的
  地理位置显示服务器。定位需要约 25 MB 的城市级数据集；该数据集不随 App 附带，也不会自动
  下载，确认对话框会先给出当前的实际大小。无法定位的服务器排列在下方，标注为
  *Private address* 或 *No location data*；手动填写的坐标优先于所有自动来源。
  地址不会发送到任何地理定位服务。见[地球仪视图](/docs/zh/advanced/globe/)。
- **性能测试。** 在服务器上运行 Yet Another Bench Script，并保存结构化、可比较的
  结果。完整跑一次需要 10–20 分钟，离开本页或关闭 App 都不会中断。Geekbench
  默认关闭，因为它会下载专有二进制文件并将结果发布到公开页面；iperf 默认使用
  精简节点，IP 查询默认关闭，原因相同。
- **桌面端状态图标。** macOS 菜单栏、Windows 托盘和 Linux 面板会为每台服务器
  显示一行，包含状态符号、读数和折线图。Linux 只显示单行，不显示图表。
- **将服务器分享到另一台设备。** 服务器记录（含密钥库中保存的私钥）以二维码或
  `.sbxsrv` 文件的形式传递。二维码附带一个单独显示的一次性 6 位数字，10 分钟后
  失效；文件使用你设置的 passphrase 加密，不失效。跳板服务器、密钥文件路径和
  BMC 凭据不包含在内。
- **崩溃报告。** 有报告时，**设置 → 应用 → 隐私 → 崩溃报告** 会显示入口。报告
  不会自动上传；你可以删除、复制，或复制并打开 GitHub issue。自动上传由单独的
  *诊断信息*设置控制。已知的服务器名称、地址和用户名会替换为占位符。

### 变更

- **列表栏可折叠，搜索在栏内完成。** 搜索不再压在列表上方新开页面，而是取代
  切换器在栏中的位置，边输入边过滤。服务器列表可按名称或连接状态排序，默认仍为
  设置页中配置的顺序。
- **虚拟文件系统不再出现在磁盘列表中。** snap 修订、swap 区域、容器层和
  `fuse-overlayfs` 均被排除，且磁盘的 source 与 filesystem type 分别判断——
  名为 `tmpfspool` 的 ZFS 池属于存储，不会被当作需要隐藏的文件系统。

### 修复

- 恢复终端中缺失的虚拟按键选项。
- 地理位置数据的更新和地球仪刷新在下载失败或中断时有更完善的防护。

## v1.0.1553 — 2026-08-29

### 变更

- **远程备份要求设置备份密码。** 密码为空时无法上传到 iCloud、WebDAV 或 Gist；
  只要开启任一远程同步，该密码也不允许删除。已有的未加密远程备份仍可恢复，并在
  下次上传时被加密版本替换。本地文件和剪贴板备份仍可不加密。
- **服务页取代 Systemd 页**，并识别服务器上实际使用的管理器：systemd、procd 或
  OpenRC。s6、runit、upstart、launchd 和 sysvinit 会被识别并报告为不支持。
  procd 和 OpenRC 的操作始终需要 root；systemd 仅在 system scope 单元上需要。
  账户没有用户会话总线时，只列出系统单元，页面会说明这一点。
- **SSH 加密运算改为 Rust 实现。** 记录层 cipher 与连接级加密运算（x25519、
  Ed25519 与 ECDSA、bcrypt_pbkdf）不再运行在绘制帧的 isolate 上。AOT 实测：
  记录层在 32 KiB 包下由 15 MB/s 提升到 486 MB/s，Ed25519 验签由 1.215 ms 降到
  0.019 ms，ECDSA P-256 验签由 3.900 ms 降到 0.084 ms。解析后的私钥也会在连接
  之间复用。AES-GCM、ChaCha20-Poly1305 和 RSA 仍使用 Dart 实现。

### 修复

- Android 上在终端内按系统返回键不再关闭整个终端；前台服务的生命周期已串行化，
  避免空会话列表导致服务刚启动就立即停止。Android 16 可能将此视为未履行
  `startForegroundService` 约定并结束 App。
- 修复启动时服务器刷新重叠的问题。启动流程、生命周期处理和自动刷新定时器此前
  各自启动任务池，导致并发数倍增；现在由同一个调度器管理队列。
- SSH 命令输出不再被误判为不完整；容器页会隐藏部分输出，不再把截断的 stdout
  当作操作失败的原因。
- 设置页和 Logs 页的返回操作逐级退出，不再直接离开整个设置路由。
- 前台服务不再在每次会话同步时重复请求通知权限。

## v1.0.1538 — 2026-08-26

此版本包含 v1.0.1466 以来的全部改动，其中含两个预发布版本 v1.0.1480 和
v1.0.1491。

:::caution
此版本将存储从 Hive 迁移到加密的 SQLite 数据库。迁移是单向的：旧版本无法打开
新版本写入的数据，且在这个版本上，降级会在启动时中止，屏幕上没有任何提示。
若可能需要回退，请在更新前导出备份。（v1.0.1617 新增了说明该情况并允许导出或
清除数据的界面。）
:::

### 新增

- **BMC（Redfish）。** 2016 年前后的企业级管理硬件通常支持 Redfish。服务器详情页
  现在可显示其电源状态和传感器——进风口与 CPU 温度、风扇转速、机箱功耗——并执行
  电源操作：开机、关机、强制断电、重启、电源循环，每项操作前都有确认对话框并标明
  reset 类型。没有*忽略证书*选项：首次使用时信任，并显示指纹供你核对。账户是共享
  记录，在 **设置 → BMC 账户** 中管理，每个账户会显示引用它的服务器数量。标记为
  Beta。
- **iOS 上同时使用多个 Linux 系统。** **设置 → 终端 → Linux (Beta)** 可并列安装
  多个发行版，每行显示各自的标识和版本；点击选择*新建*终端在其中打开。发行版和
  版本来自签名的 manifest，使用编译进 App 的密钥验证。
- **在 App 内生成 SSH 密钥对。** **设置 → 私钥** 的新增按钮现在提供 *Generate key
  pair* 和 *Import*：Ed25519（默认）、ECDSA P-256、RSA 2048 和 RSA 4096。生成
  完成后页面显示公钥和复制按钮，以及需要追加到 `authorized_keys` 的那一行。私钥
  现在按导入时的原样保存，因此导入的加密私钥保持加密，passphrase 在首次使用时
  询问，不再在导入时被去除。
- **SCP 文件传输**，用于 SSH 服务端没有 SFTP 子系统的旧设备或嵌入式主机。在服务器
  编辑页选择：*File* 一行提供 **SFTP**/**SCP** 选择。它需要服务器上有 `scp` 命令
  以及常用的文件工具。SFTP 会话建立失败时，文件浏览器会提示这一选项。
- **悬浮终端。** 终端操作栏的画中画按钮将其移入浮在所有标签页上方的窗口：桌面端
  可拖动和调整大小，手机端是一个可展开为 sheet 的胶囊。它是同一个会话，因此标签页
  绘制占位视图而非第二个视图，标签中也会标明该终端处于悬浮状态。
- **跨服务器的 Agent 工作区**，即 *Agent* 标签页，其工具可读取 App 自身状态：
  服务器列表、连接状态、连接与断开，以及将临时连接保存为新的服务器。临时主机的
  密码在 App 内询问而非在对话中，并明确说明何时会保存该主机和密码。
- **发行版标识。** App 会识别对端的发行版，并可在服务器名称旁绘制小标识。默认
  关闭，位于 **设置 → 服务器 → 发行版标识**。未配置 *Mark URL* 时使用四种内置
  标识（Debian、Gentoo、Alpine、NixOS），其余使用通用图标。开启时会先显示条款
  对话框，因为标识只表示本机从远端读取到的内容。
- **密钥与密码组合认证**，以及对支持该方式的服务器使用 keyboard-interactive
  认证。

### 变更

- **存储从 Hive 迁移到一个加密的 SQLite 数据库。** 迁移在启动时静默执行，采用复制
  而非删除，旧数据在迁移后仍保留在磁盘上。转换失败的记录会被跳过，App 继续运行，
  该 store 为空。
- **小组件改从 agent 的认证 API 读取数据。** 手动填写的 `/status` 地址无法访问需
  认证的 endpoint，而所需的登录正是这些地址原本要避免的，因此这些地址不再可用且无法
  转换——一次性对话框会说明这一点，在 App 中配置一次服务器即可供所有手表和小组件
  使用。必须配置 agent。手表服务器由白名单改为黑名单：所有配置了 agent 的服务器默认
  同步，可在 **设置 → 应用 → iOS → Watch 应用** 中排除。iOS 小组件现在需要 iOS 17，
  手表 App 和 complication 需要 watchOS 10。
- **Android 通过前台服务在后台保持 SSH 连接**，不再在切换到其他 App 后数秒内断开
  所有连接。通知权限关闭时，*后台运行* 下会出现一行说明需要常驻通知，点击可打开
  系统设置。
- Android Auto Backup 不再适用：数据库使用与设备绑定的密钥加密，跨设备恢复无法
  携带该密钥。跨设备恢复使用 App 自身的加密导出。

### 修复

- 支持没有家目录的服务器。
- tmux 的 UTF-8 渲染正确，其界面已本地化。
- Windows 输入法候选窗口的文字可以传入终端。
- 使用 `systemctl` 列出单元，`systemctl list-units` 单独会漏掉的单元也能显示。
- 拆分 Android 构建不再破坏可复现构建；Impeller 兼容性探测在启动前完成，而非之后。

## v1.0.1466 — 2026-07-16

### 变更

- **更新检查改读 GitHub Releases**，不再读取厂商 manifest，iOS 使用 App Store 查询。
  对话框现在会显示已安装版本与提供版本之间每个版本的说明，而不只是最新一个。仅发布到
  CDN 的版本不再被检测到。
- Docker host 字段在 Podman 服务器上显示为 *Edit CONTAINER_HOST*，在 Docker 服务器
  上显示为 *Edit DOCKER_HOST*，并使用各自独立的存储键，同一台服务器的 Docker host
  与 Podman host 不再互相覆盖。

### 修复

- **备份可以恢复了。** 序列化此前对无法编码的对象回退到 `toString()`，因此服务器、
  snippet、私钥、端口转发和 Wake-on-LAN 配置被写成 `Instance of 'Spi'` 形式的字符串
  ——备份看似完成，但无法恢复为对应记录。现在每个模型都有明确的序列化分支，不支持
  的类型会直接报错而非静默降级。1.0.1448–1.0.1450 版本创建的备份受此影响，无法完整
  恢复。
- 名称或镜像中含空格的容器不再导致整个列表的列错位。
- 此版本的韩语翻译已完整。

## v1.0.1450 — 2026-06-27

:::caution
升级后，每台服务器会要求重新确认 SSH 主机密钥，每种密钥类型各一次。此前保存的
指纹是 MD5 摘要，现在为 SHA256，App 会将其判断为密钥变更并要求确认。这是预期
行为，不代表服务器被攻击。
:::

### 新增

- **终端支持 tmux。** 连接时自动 attach、会话与窗口选择器、默认会话名，均在
  **设置 → 终端 → tmux auto-attach** 下，默认关闭。终端的虚拟按键栏新增 tmux 键，
  服务器未安装 tmux 时会给出提示。
- **自动重连。** 连接中断后会重连，显示可取消的进度对话框，并重新 attach tmux。
  未使用 tmux 的 shell 也会重连，重连后是一个新的 shell，其状态会丢失。
- **桌面端可选择内置终端或系统 SSH。** 开关位于 **设置 → 终端 → 通用**：内置终端
  使用 App 自带的终端，系统 SSH 在外部终端模拟器中启动系统 `ssh` 命令。macOS 上
  外部终端固定为 Terminal.app，不再可配置；该行现在仅 Linux 可用。

### 修复

- SFTP 下载显示传输速率（`已传输 / 大小 – 百分比 – 速度`），速度提升：分块大小由
  16 KB 提高到 32 KB，最大在途请求数由 1 提高到 64。
- sudo 密码自动填充可识别更多形式的提示符，包括全角冒号；没有活动的提示符时会
  明确提示，而不是无任何反应。
- 终端不再注入用户未配置的 locale，只传递服务器自身的环境变量。

## v1.0.1426 — 2026-06-05

### 新增

- **进程磁盘 I/O 速率**显示在进程页，为可排序的 *R/s* 和 *W/s* 两列。需要窗口宽度
  至少 1100 px、服务器报告相应计数，且需要两次采样，因此打开页面后的第一次读数为空。

### 修复

- SFTP 下载不再卡住；页面 dispose 时会关闭持久化的 SFTP channel。
- 虚拟键盘可识别更多形式的 sudo 密码提示符。

## v1.0.1409 — 2026-05-12

### 新增

- **拉取镜像**：容器页的镜像行菜单提供 *Pull* 和 *Delete*。dangling 镜像没有
  repository 或 tag，不会拉取任何内容并会给出提示。
- **两台跳板服务器，按顺序尝试。** 服务器编辑页的 SSH 高级设置最多可配置两台跳板
  服务器，按尝试顺序编号，第一个成功转发的胜出。超时、连接被拒绝和转发失败会尝试
  下一台；认证和权限错误则直接终止，不再尝试。会形成循环的选择不会出现在选项中，
  且跳板服务器与 `ProxyCommand` 不能同时设置。
- 点击文件直接打开编辑器，长按保留操作菜单。超过 1 MB 的文件编辑器不予打开。
- AI 的 API endpoint 可以填写完整的 `.../chat/completions` URL，也可以填写服务
  base URL；`v1` 和路径会按需补全。

### 变更

- 终端的 *Theme* 设置新增 **Auto**，跟随 App 自身的主题，而非系统主题。

### 修复

- 桌面端系统 SSH 路径写入的临时私钥文件现在在 Windows 上也会收紧权限，使用
  `icacls`；该步骤失败时会报错并中止启动，不再使用权限过宽的私钥继续。
- 状态命令超时不再使共享 shell 在本次连接的剩余时间内卡住，会回退到一次性
  channel。

---

### Src Content Docs Zh Installation (`docs/src/content/docs/zh/installation.mdx`)

---
title: 安装
description: 下载并安装 Server Box
---

Server Box 支持多个平台。请根据你的设备选择对应的下载来源。

## 移动端

### iOS

从 **[App Store](https://apps.apple.com/app/id1586449703)** 下载。

### Android

你可以从以下来源选择安装包：

- **[GitHub Releases](https://github.com/lollipopkit/flutter_server_box/releases)**：项目发布页
- **[F-Droid](https://f-droid.org/packages/tech.lolli.toolbox)**：FOSS 应用商店
- **[OpenAPK](https://www.openapk.net/serverbox/tech.lolli.toolbox/)**：第三方应用商店

## 桌面端

### macOS

从 **[GitHub Releases](https://github.com/lollipopkit/flutter_server_box/releases)** 下载，或使用 Homebrew Cask：

```sh
brew install --cask server-box
```

要求 macOS 13 或更高版本。GitHub Releases 分别提供适用于 Apple silicon 的 `ServerBox-<版本>-arm64.dmg` 和适用于 Intel 的 `ServerBox-<版本>-amd64.dmg`；Homebrew 会自动为当前 Mac 选择正确的版本。

Mac App Store 版本已不再更新。直接安装 DMG 版本即可，首次启动时会导入 App Store 版本的数据。

### Linux

从 **[GitHub Releases](https://github.com/lollipopkit/flutter_server_box/releases)** 下载 `x86_64` 安装包，并将下方文件名中的 `N` 替换为实际下载文件的构建号：

- **Debian / Ubuntu（`.deb`）**：

  ```sh
  sudo apt install ./ServerBox_v1.0.N_amd64.deb
  ```

- **Fedora / RHEL / openSUSE（`.rpm`）**：

  ```sh
  sudo dnf install ./ServerBox_v1.0.N_x86_64.rpm
  # openSUSE：
  sudo zypper install ./ServerBox_v1.0.N_x86_64.rpm
  ```

- **AppImage（`.AppImage`）**：下载 `ServerBox_v1.0.N_amd64.AppImage`（Ubuntu 22.04 / Debian 12 等较旧 glibc 系统可选 `_legacy_amd64.AppImage`），赋予可执行权限后运行。
- **便携压缩包（`.tar.gz`）**：解压 `ServerBox_v1.0.N_linux_amd64.tar.gz` 后运行 `ServerBox_v1.0.N_linux_amd64/bundle/ServerBox`。

`.deb` 与 `.rpm` 安装包会将程序安装到 `/opt/serverbox`，创建 `/usr/bin/serverbox` 符号链接，并注册桌面入口与图标；基于 glibc 2.35 构建，兼容 Ubuntu 22.04+、Debian 12+、Fedora 与 openSUSE。

### Windows

从 **[GitHub Releases](https://github.com/lollipopkit/flutter_server_box/releases)** 下载安装程序（`ServerBox_v1.0.N_windows_amd64.exe`），或使用 WinGet / Scoop 安装：

```sh
winget install lollipopkit.serverbox
```

```sh
scoop bucket add extras
scoop install extras/serverbox
```

安装程序会为当前用户安装到 `%LOCALAPPDATA%\Programs\ServerBox`，不需要管理员权限，并添加开始菜单项和卸载程序。新版本会直接覆盖安装旧版本，设置和服务器数据会保留。

安装程序没有代码签名，SmartScreen 可能提示"未知发布者"。便携版 zip 也会随版本一并发布（同时作为官方 Scoop `extras` 桶的安装源）。

## watchOS

Watch App 随 iOS App 一起通过 **[App Store](https://apps.apple.com/app/id1586449703)** 提供。安装后，在 iPhone App 中配置要显示的服务器。Watch App 需要 watchOS 10 或更高版本，iOS App 本身仍支持 iOS 15 或更高版本。

## 从源码构建

如果要从源码构建 Server Box，请参阅开发文档中的[构建指南](/docs/zh/development/building/)。

## 版本信息

各版本的变更内容见[更新日志](/docs/zh/changelog/)，安装包见
[GitHub Releases](https://github.com/lollipopkit/flutter_server_box/releases)。

---

### Src Content Docs Zh Introduction (`docs/src/content/docs/zh/introduction.mdx`)

---
title: 介绍
description: 了解 Server Box 及其功能
---

Server Box 是一款跨平台服务器管理应用，可远程监控和管理 Linux、Unix 及 Windows 服务器。

## Server Box 是什么？

连接服务器有两种方式：使用 **SSH**，或使用服务器上运行的 **[Monitor](/docs/zh/advanced/monitor-agent/)**。SSH 不需要在服务器上安装额外软件，并提供终端、SFTP 和端口转发等功能。Monitor 适合不方便开放 SSH 端口的服务器。它还会持续保存监控历史，因此图表可以显示 App 连接前采集的数据。

同一台服务器可以同时配置 SSH 和 Monitor。App 会按照设置的优先顺序尝试连接，并在需要时回退到另一种方式。两种连接提供的功能都会保留。

## 核心功能

- **实时监控**：查看 CPU、内存、磁盘使用率、网络速度、GPU 状态和系统温度
- **SSH 终端**：通过 SSH 连接服务器，支持多标签页和自定义外观
- **SFTP 客户端**：浏览和管理服务器文件
- **容器管理**：管理 Docker 和 Podman 容器
- **进程管理**：查看和管理系统进程
- **Systemd 服务**：启动、停止和监控 systemd 服务
- **网络工具**：运行 iPerf、Ping 和网络唤醒（WoL）
- **代码片段**：保存并执行自定义 Shell 命令
- **[Agent](/docs/zh/advanced/agent/)**：让模型诊断服务器问题并提出操作建议，供你审核和批准

## 支持平台

- **移动端**：iOS 和 Android
- **桌面端**：macOS、Linux 和 Windows
- **配套应用**：watchOS

## 许可证

本项目采用 AGPL v3 许可证。源代码可在 [GitHub](https://github.com/lollipopkit/flutter_server_box) 获取。

---

### Src Content Docs Zh Privacy (`docs/src/content/docs/zh/privacy.md`)

---
title: 隐私政策
description: Server Box 保存、发送哪些数据，以及如何控制这些行为
---

最后更新：2026-10-05。

Server Box 是连接你所配置服务器的客户端。它没有用户账号，开发者也不运营任何中转 SSH、SFTP 或 Monitor 流量的服务。连接时，流量会从 App 直接发往你设置的地址。

App 还会为诊断和你使用的功能发起独立的网络请求。下文会说明这些请求的目标和内容。Server Box 不包含广告，不使用广告标识符，也不会跨 App 追踪。

## 保存在本设备上的数据

| 数据 | 保存方式和行为 |
|---|---|
| 服务器名称、地址、端口、用户名和设置 | 加密的 SQLite 数据库 |
| SSH 密码、私钥、Monitor 和 BMC 凭据、保存的 sudo 密码、私钥口令、AI 提供商的 API 密钥、MCP 请求头，以及 WebDAV 的设置（含密码） | 加密的 SQLite 数据库；数据库加密密钥保存在系统钥匙串中 |
| 备份密码和同步密钥 | 系统安全存储 |
| App 日志 | 仅保存在本机日志文件中；为便于排查问题，仅保留当前运行和上一次运行的日志 |
| Agent 对话、记忆笔记、AI 提供商与工具设置 | 本机加密数据库；对话中可能包含提示词、模型回复、命令输出、终端文本、文件内容和读取的网页 |
| 活动终端输出 | 仅保存在当前活动会话中，会话结束后不再保留 |
| 下载的城市级位置数据 | 仅在你确认下载后，以未加密文件保存在 App 数据目录中；详见[地球仪与位置数据](#地球仪与位置数据) |
| 服务器上报的公网网卡地址结果（包括“无公网地址”） | 保存在 App 加密数据库中，每台服务器一条。记录满 7 天后会在后续状态轮询中刷新。经纬度坐标不落盘，每次需要时从本地数据集实时计算 |

Agent 对话不会纳入备份，也不会随设备同步发送；除非你从对话历史中手动删除，否则对话仅保留在本机。**备份 → 同步内容** 中可以逐类选择同步的内容：设置、AI（提供商、工具设置、命令权限和记忆笔记）、sudo 密码与 API 密钥（含 MCP 请求头和 WebDAV 的设置）、私钥口令（仅在保存口令的设备上）、字体、图片和 Skills，以及性能测试结果。不过在使用 Agent 功能时，相关对话上下文仍会发送给你所配置的 AI 提供商，详见 [AI 请求](#ai-请求)。

备份仅在你主动触发或启用自动同步时生成。根据选项和格式，无论是否加密，备份都可能包含服务器设置及其 SSH 密码、私钥、代码片段、端口转发、远程桌面配置及其保存的密码、容器设置、连接历史、应用偏好设置和 AI 设置；保存的 sudo 密码、API 密钥、MCP 请求头、WebDAV 设置以及私钥口令只包含在加密备份中。Agent 对话、AI 提供商与 MCP 服务器的登录状态及设备本地状态均不包含在内。字体、图片、Skills 和性能测试结果通过 iCloud、WebDAV 和 LK Cloud 同步，不写入备份文件。

未设置备份密码时，本地导出文件不会加密；设置备份密码后，导出的文件会在写入或上传前加密为 [age](https://age-encryption.org) 口令模式文件，无需借助 ServerBox，直接使用 `age -d` 和备份密码即可解密。自动同步要求必须设置非空的备份密码。同步数据使用同步密钥加密，而同步密钥本身以 `identity.age` 存放在同一目录下，是唯一直接由备份密码加密的文件（使用 `age -d` 加备份密码可解密出同步密钥，再使用 `age -d -i` 加同步密钥即可解密其余文件）。若当前设备的备份密码无法解开该密钥，同步将暂停，直至输入与其他设备一致的密码。备份上传至 iCloud、WebDAV 或 LK Cloud 后，同时受对应服务端存储与访问策略约束。

## 自动诊断数据

自动诊断是 Server Box 发往开发者诊断服务的唯一遥测数据。首次自动上传前，引导页会先提示你选择；之后可随时在 **设置 → 应用 → 隐私** 中更改。

| 级别 | 自动发送的内容 |
|---|---|
| **不发送** | 不自动上传任何内容。本机日志仍保留在设备上，你可随时手动导出报告。 |
| **基本信息** | 已捕获的崩溃和未处理异常，以及构建信息、平台信息和必要的诊断上下文记录。App 正常运行时不会持续发送数据。 |

所有平台的默认值均为**不发送**。除非你在引导页或设置中主动选择**基本信息**，否则不会上传任何数据。

切换为**不发送**后会立即停止自动上报，无需重启应用。

早期版本曾提供**完整信息**级别（包含性能追踪与功能使用统计），现已移除。旧版本升级后会自动转为**基本信息**，并清除此前保存在本机的统计标识符。当前任何级别均不会采集或上传性能追踪与功能使用事件。

### 自动报告包含的内容

视平台和错误类型而定，自动报告可能包含：

- 错误类型、错误详情及调用栈
- 应用构建号、存储结构版本，以及当前构建是否包含内置 Linux 运行环境
- 操作系统与内核版本、设备型号、CPU 核心数、内存容量及应用内存占用（因平台而异）
- 界面语言、区域设置与时区
- Dart 与 Flutter 运行时版本
- 结构化诊断操作记录，如连接方式、终端或文件传输后端类型，以及对应操作的结果
- 平台提供的原生崩溃（native crash）、应用无响应（ANR）或主线程卡死（hang）原因及调用栈

这些记录使用固定的操作名称，与服务器相关的字段均经过泛化或脱敏处理，不会将终端输出、文件内容、密码或私钥写入诊断字段。无论选择哪个级别，应用都不会上传常规运行日志。

错误消息和调用栈来自底层库，可能包含非应用主动生成的文本，因此无法保证所有异常文本都不含服务器信息。请勿将自动诊断视为对所有异常文本的完全匿名化。

应用本身不注册原生崩溃信号处理器。当系统提供原生崩溃、ANR 或卡死记录时，Server Box 会在下次启动时读取。若已开启自动诊断，该记录会作为错误报告发送；否则将保留在本机，供生成手动报告时使用。

## 脱敏与手动崩溃报告

结构化诊断记录在生成时即完成脱敏转换，随后才交由上报组件处理。记录采用固定的操作名称，服务器名称、地址和用户名等信息均会替换为占位符。

手动报告包含更完整的诊断信息。应用崩溃后，Server Box 会结合上次运行留下的日志以及系统提供的原生崩溃或卡死记录生成报告。应用会自动替换可识别的服务器名称、SSH 主机地址、SSH 用户名和 Monitor 地址，但报告中仍可能残留无法自动识别的字段。

最新生成的报告保存在 **设置 → 应用 → 隐私 → 崩溃报告** 中（仅当存在报告时显示该入口）。你可以先查看完整内容，再选择复制、复制并打开 GitHub Issue 页面，或直接删除。应用不会自动发布手动报告。该入口在所有诊断级别（包括**不发送**）下均可用。

**任何级别都不会自动上传应用运行日志。** 在**基本信息**级别下，应用可能发送导致异常退出的错误及调用栈，并附带前文所述的构建与设备信息，但不包含日志原文。若错误发生在上报通道初始化之前，应用可能会在下次启动时补发。保存在本机的手动报告会一直保留，直到你手动删除或被后续崩溃的新报告覆盖。

由于历史日志、曾连接的主机信息及无法自动识别的内容仍可能出现在手动报告中，手动报告不保证完全匿名。提交至 GitHub 的内容将公开可见，并适用 [GitHub 隐私声明](https://docs.github.com/site-policy/privacy-policies/github-privacy-statement)。

## AI 请求

Agent 使用你在 **设置 → 应用 → AI → 提供商** 中配置的服务商（包括模型目录中的内置服务商与自定义接口地址）。仅当你主动发送 Agent 消息时，应用才会向当前对话模型所属的服务商发起请求。

视操作类型而定，请求可能包含你输入的提示词、选中的终端文本、近期对话记录、已配置的服务器名称，以及 Agent 执行任务所需的上下文。执行命令或文件操作后，其返回结果也可能随后续请求一并发送，以便模型继续处理。

命令输出和文件内容中可能包含密码、令牌或其他敏感信息。发送前请留意相关内容，并查阅所选服务商的隐私政策。

服务商的 API Key 保存在 App 的加密数据库中，仅发送给对应的服务商。为避免密钥明文传输，连接非本机的明文 `http://` 自定义服务商默认会被拒绝，除非你单独为该服务商开启明文许可。当 Agent 使用 **网页读取** 工具时，会由本机直接请求目标网页；你添加的 MCP 服务器则会收到对应的工具调用请求。从远程地址安装或更新技能（Skill）时，应用会通过 `https` 从你指定的来源（GitHub、GitLab 或对应网站）下载；从本地文件夹或 `.zip` 压缩包安装时仅在本地读取，不发起网络请求。技能以文件形式保存在本机，随字体和图片一起同步。MCP 服务器的请求头与登录令牌保存在 App 的加密数据库中，仅发送给目标 MCP 服务器，且除本机地址外均强制使用 `https`；请求头随 sudo 密码与 API 密钥同步，登录状态只保留在本机。Server Box 不会通过开发者服务器中转任何 AI 请求。

## 地球仪与位置数据

地球仪功能会将每台服务器标注在对应地理坐标上。Server Box 使用保存在本机的数据集解析位置，不会将服务器地址发送给第三方地理位置 API，也不会在每次查询时请求远程服务。若服务器使用域名配置，设备仍会通过系统 DNS 解析域名，行为与常规连接一致。

服务器坐标按以下优先级依次确定：

- 你在服务器编辑页 **更多 → 位置** 中手动填写的坐标。
- 服务器自身上报的公网 IP 地址（仅在应用通过内网地址连接时使用）。该地址取自常规 SSH 或 Monitor 状态轮询结果，并通过本地已下载的城市级数据集解析，不会额外执行外部命令或请求第三方公网 IP 查询接口。
- SSH 或 Monitor 连接所使用的目标地址，通过本地已下载的城市级数据集解析。

城市级数据集不随应用安装包附带，也不会自动下载。在地球仪视图或 **设置 → 服务器 → 通用 → 地球仪** 中点击 **下载** 后，应用会先获取一份小型清单文件（manifest），在确认弹窗中展示下载体积、安装后占用空间、数据源 URL 及许可署名。仅在你确认后，应用才会开始下载数据文件。目前下载体积约为 25 MB，解压安装后约占 52 MB（具体数值以弹窗显示为准）。数据集按月更新；点击 **更新** 会直接替换现有文件，点击 **删除** 则会移除数据集。位置数据由 [DB-IP](https://db-ip.com) 提供，遵循 CC BY 4.0 许可协议。

下载服务器会收到来自你当前网络的清单及数据文件请求（含常规 HTTP 请求可见的来源 IP 与请求时间）。数据集安装完成后，所有位置查询均直接读取本地文件，不会再向下载服务器发送查询请求，因此远程服务无法获知你查询了哪些服务器地址、查询次数或查询时间。

由数据集自动解析出的坐标不会持久化保存，每次需要时均从本地数据集实时计算；删除数据集后，自动解析的位置即不再显示。你在服务器设置中手动填写的坐标不依赖该数据集，删除后依然有效。

应用仅在本地缓存服务器最近一次上报的公网网卡地址结果（包括“未上报公网地址”状态）。该记录保存在本机加密数据库中，不纳入备份或同步；缓存满 7 天后，会随常规状态轮询自动刷新。

关闭 **地球仪** 开关会隐藏服务器页面的地球仪入口并停止位置解析，但不会自动删除已下载的数据集或已缓存的公网地址记录。如需清理数据文件，请在数据集设置项中点击 **删除**。删除服务器时，对应的公网地址缓存记录会一并清除。

在**基本信息**诊断级别下，错误报告可能附带脱敏的操作轨迹（如打开地球仪视图、各来源成功解析的服务器数量统计），但绝不包含具体坐标、IP 地址、服务器名称或所属国家。

## 其他网络请求

以下网络请求仅在你使用对应功能时发起，且不会附带前文所述的自动诊断数据：

| 请求类型 | 目标地址 | 触发时机与传输内容 |
|---|---|---|
| AI 请求 | 你配置的服务商接口 | 发送 Agent 消息时；详见 [AI 请求](#ai-请求) |
| 备份与同步 | iCloud 或自建 WebDAV | 上传、下载或同步备份时；传输上传的备份文件（可能已加密）。同步时传输由同步密钥加密的备份和增量变更，以及由备份密码加密的同步密钥 |
| 检查更新 | `api.github.com` | 开启自动检查更新后，在应用启动时发起 |
| Linux 环境清单 | `github.com` | 检查内置 Linux 运行环境更新时发起，获取版本元数据与签名 |
| Linux 环境镜像 | 经签名验证的清单所指定的镜像源 URL | 安装或更新内置 Linux 运行环境时发起；下载后会根据清单中的摘要校验文件完整性 |
| 城市级位置数据 | `ipgeo.lollipopkit.com`（失败时回退至 GitHub Releases） | 在地球仪或 **设置 → 服务器 → 通用 → 地球仪** 中点击 **下载** 或 **更新** 时发起。先获取清单文件，确认后下载数据包；后续查询均在本地完成。详见 [地球仪与位置数据](#地球仪与位置数据) |
| 服务器图标或发行版标识 | 你配置的自定义 URL | 配置自定义图标 URL 后发起，目标图片服务器会收到加载请求 |
| 赞助列表 | `cdn.lollipopkit.com` | 打开赞助页面时发起 |
| 文档与反馈链接 | `serverbox.lollipopkit.com` 或 `github.com` | 点击相关外部链接时打开 |

连接你的服务器、BMC 接口以及自建 Monitor 时，所有流量均直连你配置的目标地址，不经过开发者的任何服务器。

## 诊断数据接收端

错误报告会发送至开发者维护的 Sentry 兼容服务（`sentry.lollipopkit.com`）。应用不向任何第三方统计或分析平台发送数据。

上报地址直接定义在开源代码中，因此基于未修改源码编译的构建版本同样使用该地址（除非编译者自行修改）。即便如此，自动诊断依然默认关闭，须由用户主动开启后才会生效。

诊断数据绝不用于广告投放，不与任何第三方共享，也不用于跨应用或跨网站追踪。诊断服务仅在排查对应问题所需的期限内保留报告。如需申请删除已上报的数据，请在 [github.com/lollipopkit/flutter_server_box](https://github.com/lollipopkit/flutter_server_box/issues) 提交 Issue，并附上大致上报时间、应用版本号及问题简述。请勿在公开 Issue 中填写密码、密钥或其他敏感信息。

## Watch 应用与桌面小组件

Apple Watch 应用、表盘复杂功能（Complication）以及 iOS / Android 桌面小组件均直接请求你部署的 Monitor 服务。Server Box 会为每个展示端签发独立的只读凭据，仅允许调用 Monitor 指标读取接口（`/api/v1/status`、`/api/v1/metrics` 和 `/api/v1/metrics/history`），无法打开终端、执行命令或访问文件系统。

只读凭据在 Watch 端保存在手表独立钥匙串中，在 iOS 端保存在应用组共享钥匙串中，在 Android 端则使用 AndroidKeyStore 密钥加密存储。小组件的配置列表包含服务器名称与 Monitor 地址以便你选择目标主机，而访问凭据则单独存放在系统安全存储内。所有配置了 Monitor 的服务器默认均会同步给小组件；Watch 端可在应用**设置**中单独勾选要排除的服务器。只要主应用能连通目标 Monitor，移除或排除服务器时便会同步吊销对应的 Watch 或小组件凭据。

## 应用商店渠道说明

通过 App Store 和 Google Play 安装的版本还会遵循所属平台自身的崩溃与诊断机制。Apple 和 Google 会依据各自的隐私政策收集相关系统级信息，这部分数据独立于 Server Box 的诊断机制之外。详情请参阅 [Apple 隐私政策](https://www.apple.com/legal/privacy/) 与 [Google 隐私政策](https://policies.google.com/privacy)。F-Droid 渠道版本不包含任何应用商店附加的上报组件。

## 未成年人保护

Server Box 是一款面向系统管理员与开发者的服务器管理工具，不面向未成年人设计，也不会主动收集任何可用于识别未成年人身份的信息。

## 政策变更

若诊断数据的收集范围或方式发生实质性变更，应用会重新弹窗征求你的确认，此前授予的许可不会自动延续至变更后的方案。

## 联系方式

如有隐私相关疑问，请在 [github.com/lollipopkit/flutter_server_box](https://github.com/lollipopkit/flutter_server_box/issues) 提交 Issue。

---

### Src Content Docs Zh Quick Start (`docs/src/content/docs/zh/quick-start.mdx`)

---
title: 快速开始
description: 添加服务器并查看监控数据
---

按以下步骤添加服务器并查看监控数据。

## 第一步：添加服务器

1. 打开 Server Box。
2. 点击 **+** 添加服务器。
3. 在连接方式中选择 **SSH**，然后填写：
   - **名称（Name）**：用于在 App 中识别服务器的名称
   - **主机（Host）**：IP 地址或域名
   - **端口（Port）**：SSH 端口，默认是 `22`
   - **用户（User）**：SSH 用户名
   - **密码或密钥（Password or Key）**：选择一种身份验证方式
4. 点击 **保存（Save）**。

### 使用 Monitor 连接

如果服务器不方便开放 SSH 端口，也可以使用 Monitor：

1. 在服务器上安装并配置 [Monitor](/docs/zh/advanced/monitor-agent/)。
2. 在添加服务器页面开启 **Monitor HTTP**。
3. 填写 Monitor 地址和它的密码。自签名证书会在首次连接时显示，核对 SHA-256 后信任即可，也可以事先在 **Monitor 证书** 里查看。
4. 保存配置。

SSH 和 Monitor HTTP 可以同时启用。两者同时存在时，**优先使用**只决定 App 先尝试哪一种连接，另一种连接仍然可用。仅配置 Monitor HTTP 的服务器不包含 SSH 凭据，其命令、终端和文件功能的范围由运行 Monitor 的系统账户决定。

## 第二步：连接并查看状态

1. 点击服务器卡片。
2. 连接成功后，你可以查看 CPU、内存、交换分区、磁盘和网络等状态。

使用 Monitor 的服务器可以显示 App 连接前已经积累的历史数据。仅使用 SSH 的服务器会在 App 开始采样时建立本地历史记录。

## 第三步：探索功能

连接后可以：

- **打开终端**：SSH 连接可直接打开终端；Monitor HTTP 连接以 Monitor 运行所用的账户打开 shell。
- **浏览文件**：SSH 连接使用 SFTP；Monitor HTTP 连接使用 Monitor 的文件 API。
- **管理容器**：查看和控制 Docker 或 Podman 容器。
- **查看进程**：检查正在运行的进程。
- **运行代码片段**：执行已保存的命令。
- **使用 Agent**：诊断或操作服务器，详见 [Agent](/docs/zh/advanced/agent/)。

## 实用设置

- **生物识别**：在移动端启用 Face ID、Touch ID 或指纹，快速解锁 App。
- **主屏幕小组件**：安装 Monitor 后，将服务器添加到 iOS 或 Android 小组件。
- **Android 后台运行**：需要持续保持连接时，在 App 设置中开启后台运行，并允许通知和后台活动。

---

### Src Content Docs Zh Advanced Agent (`docs/src/content/docs/zh/advanced/agent.md`)

---
title: Agent
description: 配置 Agent 的服务商、工具与操作审批
---

Agent 可将大语言模型连接到你的服务器。权限模式决定哪些操作无需询问即可执行（详见[操作审批](#操作审批)）。

发送第一条消息前，请先在 **设置 → 应用 → AI → 提供商** 中配置服务商：你可以选择内置服务商（如模型目录中的 OpenAI、Anthropic、Google 等）并填入 API Key，也可以添加自定义的 OpenAI 兼容、Anthropic 或 Google 接口地址。新对话默认使用的模型也在此页面选择。API Key 保存在应用的加密数据库中，且仅发送给所属的服务商。仅当你主动发送消息时，应用才会发起网络请求。

## 选择 Agent 入口

Server Box 提供两个 Agent 入口：

- **Agent 标签页**：可同时操作多台已配置的服务器，也可通过临时 SSH 连接访问列表外的主机，还能读取服务器列表、连接状态等应用内信息。
- **SSH Agent**：位于终端页面，仅作用于当前服务器。它可以读取当前终端屏幕内容，并在当前连接中执行命令。在终端选中文本后点击 **询问 AI**，会直接新建对话并将选中内容填入输入框。

两个入口各自维护独立的对话列表，终端内的对话归属于对应服务器。Agent 默认以浮动面板形式展示，切换到终端或文件管理器时仍可随时查看对话；点击 Agent 标题栏中的浮动按钮即可收起面板。

## 服务商与模型

**设置 → 应用 → AI → 提供商** 会列出所有内置服务商以及你添加的自定义服务商。添加自定义服务商时，需填写包含 API 版本路径的 Base URL（例如 `https://api.example.com/v1`），并选择接口协议：OpenAI Chat Completions、OpenAI Responses、Anthropic Messages 或 Google Generative AI。OpenAI 兼容接口会自动拉取可用模型列表；其他协议则需手动填写模型 ID。

为防止 API Key 明文传输，指向非本机的明文 `http://` 地址默认会被拒绝，除非你为该服务商单独开启 **允许明文 HTTP**（`http://localhost` 等本机回环地址无需开启）。

未在应用内填写 API Key 的内置服务商，会自动读取应用启动时对应的系统环境变量（变量名与官方工具一致，如 `OPENAI_API_KEY`、`ANTHROPIC_API_KEY`、`GEMINI_API_KEY`）。服务商列表会在 **系统** 分组下显示该项，并注明密钥来源变量；若在应用内填写了密钥，则优先使用应用内配置。

若环境中设置了 `OPENAI_BASE_URL`，列表会额外生成一个名为 **系统** 的服务商，指向该地址对应的 OpenAI 兼容接口，密钥取自 `OPENAI_API_KEY`，并可用 `OPENAI_MODEL` 补充接口未列出的模型。此时 `OPENAI_API_KEY` 仅发送给该自定义地址，内置 OpenAI 服务商不会将其发往 `api.openai.com`（除非该地址本身就是 OpenAI 官方地址）。环境变量配置不会持久化写入磁盘，每次均以应用启动时的环境为准。注意在 macOS 上，从访达或程序坞启动的应用不会加载终端 shell 配置文件中导出的环境变量。

旧版本中的 AI 配置（接口地址、模型、协议及密钥）在升级后会自动迁移为一条自定义服务商记录。

## Agent 工具能力

Agent 标签页提供以下工具：

| 工具 | 说明 |
|---|---|
| **Shell** | 在目标服务器上执行非交互式命令 |
| **读取文件** | 通过服务器配置的 SFTP 或 SCP 读取远程文本文件；开启本机执行后也可读取本机文件 |
| **写入文件** | 通过配置的传输协议写入或替换远程文本文件；开启本机执行后也可写入本机文件 |
| **SSH 连接** | 临时连接到未保存在服务器列表中的主机 |
| **断开 SSH** | 断开临时建立的 SSH 连接 |
| **Server Box** | 读取应用内状态，包括服务器列表与当前连接状态 |
| **记忆** | 在本机保存跨对话笔记，供后续对话读取 |
| **对话历史** | 搜索并读取过往的 Agent 对话记录 |
| **网页读取** | 从本机直接请求并读取网页内容 |
| **代码片段** | 查看、新增、修改或删除代码片段（修改前需确认，且不会将片段设为自动运行） |
| **虚拟化** | 读取虚拟化标签页中已加载的虚拟机与容器状态（不会主动连接尚未加载的宿主机） |
| **性能测试** | 查看测试结果、启动或停止测试（每次操作均需确认）。单次测试约需 10–20 分钟，完成后会通知原对话并由 Agent 解读结果 |
| **远程桌面** | 查看远程桌面配置、发起连接（在远程桌面标签页打开）或断开连接（操作前需确认；未保存密码的配置需在界面内手动连接） |

终端内的对话仅包含两个工具：在当前终端会话中执行的 **Shell**，以及 **读取屏幕**。你可以在 **设置 → 应用 → AI → 工具** 中按分类停用工具，或添加 MCP 服务器以扩展 Agent 标签页的可用工具。

点击已添加的 MCP 服务器即可编辑。需要鉴权的服务器（Streamable HTTP）可配置自定义请求头（例如名称填 `Authorization`，值填 `Bearer <token>`）。使用 OAuth 的服务器会显示 **需要登录**，点击 **登录** 后将在浏览器中完成授权，应用会自动保存并续期令牌。请求头随 sudo 密码与 API 密钥同步，登录状态只保留在本机；两者除本机地址外均强制通过 `https` 发送。

## 技能（Skills）

技能（Skill）是针对特定任务编写的一组操作指南，由 `SKILL.md` 及其同目录文件组成。你可以在 **设置 → 应用 → AI → 技能** 中安装技能，支持的来源格式与 `npx skills add` 一致：`owner/repo`、`owner/repo@skill`、GitHub 或 GitLab 仓库及子目录链接、指向 `SKILL.md` 或压缩包的直链，以及发布了 `/.well-known` 技能索引的网站；也可以直接粘贴完整的 `npx skills add …` 命令。此外还支持从本机文件夹或 `.zip` 压缩包安装。若来源中包含多个技能，可勾选需要安装的项。

模型初始仅加载每个技能的名称与简介，当任务匹配时才会按需读取完整内容（读取过程无需手动确认）。技能与工具相互独立：停用工具不会影响技能，每个技能也可单独启用或停用，终端内的 Agent 对话同样可以使用技能。由于模型会按照技能文档的指示操作，请仅从你信任的来源安装技能；技能包中附带的脚本不会自动执行。应用每天最多自动检查一次技能更新（在启动或打开技能页面时），并标记有更新的项；点击 **全部更新** 可安装更新，点击 **检查更新** 可立即手动检查，未经确认不会自动覆盖安装。

应用内置了 **serverbox-help** 技能，涵盖 Server Box 使用说明与 Monitor 部署指南，因此你可以直接向 Agent 咨询应用用法，或在批准后让 Agent 协助你在服务器上部署 Monitor。该内置技能随应用更新，可随时停用，但不可删除。

Agent 的文件读写工具依赖 SSH 连接；仅配置了 Monitor HTTP 的服务器不支持 Agent 文件工具（但仍可在独立的 **文件** 标签页中使用 Monitor 文件接口）。

## 操作审批

权限模式有 **手动**、**自动** 和 **全部放行**，可在输入框下方或 **设置 → 应用 → AI → 命令权限** 中切换，两处都对所有对话生效。该页面的规则和判断逻辑与 Monitor 的 [Agent 模式](/zh/docs/advanced/monitor-agent-mode/) 相同；Monitor 输入框中的切换同样会修改该服务器新任务的模式。

每个操作先经过命令规则：**拒绝**，然后 **询问**，然后 **允许**。之后：

- 无法撤销的操作需要询问，**全部放行** 除外。
- 其余按模式处理，只读操作和 MCP 工具也一样。**手动** 询问你；**自动** 由对话的模型按自动模式规则判断：允许就执行，拦截就把原因告诉 Agent，没有结论时询问你；**全部放行** 直接执行，拒绝和询问规则仍然生效，开启 **关闭全部放行** 后不能选这个模式。

询问时，应用会展示命令、风险等级和模型的说明。拒绝的结果会反馈给模型。在终端对话中，你也可以把命令插入终端，修改后自己执行。模型标注的风险等级仅供参考，请以实际命令内容为准。

## Agent 提问交互

当遇到需要你做决定或无法自行获取的信息时，Agent 会暂停并向你提问（每次最多 4 个问题）。每个问题会提供可单选或多选的选项（也可选择 **其他** 并手动输入），或直接请求文本输入。标题栏、对话列表及悬浮胶囊上的圆点代表对话正等待你回复，旋转图标则代表 Agent 正在处理。在等待回复期间直接发送新消息，会自动取消当前提问表单并将新消息发给 Agent。

若涉及密码、密钥或令牌，Agent 会使用专用的保密输入框。你填入的敏感内容不会发给语言模型，也不会写入对话历史：Agent 仅获得一个一次性引用句柄，在工具实际调用时由应用在本地替换为真实值（例如连接未保存密码的远程桌面配置）。

## 临时连接其他主机

Agent 可以临时通过 SSH 连接未添加至服务器列表的主机。若目标主机需要密码，应用会弹出独立对话框请求输入，请勿直接在聊天输入框中发送密码。临时连接会在列表中单独展示；如需长期保留，可将其保存为正式服务器，此后主机信息与凭据将按常规服务器加密保存。

## 在本机执行命令

**在本机执行命令** 是 **设置 → 应用 → AI** 中的独立开关，默认关闭。开启后，本机命令和其他命令一样按权限模式处理：**全部放行** 下会直接执行，不再询问。

本机命令的实际执行环境因平台而异：

- **桌面端**：直接在运行 Server Box 的宿主机系统中执行，可访问本机文件。
- **Android 与 iOS**：在应用内置的 Alpine Linux 隔离环境中执行，无法访问手机自身的文件系统、应用数据或个人文件。详见[本机终端](/docs/zh/advanced/local-terminal/)。

在不支持本机命令的平台上，该选项会自动隐藏，例如不含 Linux 引擎的 iOS 构建版本。

## 对话历史

对话记录保存在本机的加密数据库中，较长的对话会在增长过程中自动压缩上下文。你可以在历史列表中重新打开、重命名或删除对话。对话历史不纳入备份或同步。服务商配置、工具开关、命令权限及记忆笔记在 **备份 → 同步内容** 的 **AI** 下同步，API Key 在 **sudo 密码与 API 密钥** 下同步。对话消息和工具返回结果中可能包含命令输出、文件内容及你粘贴的终端文本，在对话过程中这些内容会发送给所选的模型服务商。

## 使用前提示

- 语言模型可能生成错误的建议或命令，批准任何操作前请务必仔细核对。
- 命令输出、文件内容、终端文本及网页内容可能会发送给模型服务商进行分析，发送消息或批准工具调用前请确认其中不含敏感信息。

---

### Src Content Docs Zh Advanced App Mcp (`docs/src/content/docs/zh/advanced/app-mcp.md`)

---
title: App MCP
description: 通过 MCP client 访问 ServerBox 管理的所有服务器，工具和 token 模型与 Monitor 一致
---

App 提供的 MCP server 与 [Monitor](/zh/development/monitor-agent/#api-tokens-and-mcp) 是同一套实现，覆盖 App 能连接的每台服务器：工具、返回结构、token 格式和 scope 都相同。针对某台服务器的工具都带 `host` 参数，取值为 `list` 返回的 id。

## 设置

打开 **设置 → AI → MCP Server**。选择 **新建 token**，填写名称并选择 scope，然后保存显示的 token：它只显示一次。打开开关后，以 Bearer 凭据连接 `http://127.0.0.1:49762/mcp`。删除 token 即撤销，下一次请求就会被拒绝。

选择 **监听** 可修改地址和端口。**全部** 监听通配地址，**局域网** 监听 Wi-Fi、以太网或 Tailscale 等 VPN 接口上的某个 IP，**本机** 监听回环地址。局域网会保存所选 IP；网络分配了新地址时需要重新选择。**自定义** 接受 `[::]:49762` 这样的地址和端口。

回环地址使用 HTTP。局域网和通配监听要求 TLS：把 PEM 证书链和私钥放在注册表旁边，文件名在注册表文件名后加 `.crt` 和 `.key`（默认为 `app-mcp.json.crt` 和 `app-mcp.json.key`）。iOS 上需要把两者放进同一个无密码的 PKCS#12 文件，后缀为 `.p12`。请限制私钥的访问权限，并使用证书中的域名或 IP 连接。也可以只监听回环地址，通过经过认证的 SSH 隧道访问。

stdio client 可运行 `python3 /absolute/path/to/scripts/app-mcp-stdio.py`，并在 `SERVERBOX_MCP_TOKEN` 中提供 token。目标不是 `127.0.0.1:49762` 时，设置 `SERVERBOX_MCP_HOST` 和 `SERVERBOX_MCP_PORT`。bridge 会校验远程 HTTPS 证书；使用私有 CA 时，把 `SSL_CERT_FILE` 设为其 PEM 文件。要连接回环 IP 上的 TLS 监听，设置 `SERVERBOX_MCP_SCHEME=https`。

## Token 和 scope

token 为 `sbt_` 加 64 位十六进制字符，注册表文件中只保存它的 BLAKE3 摘要（默认是 App 文档目录下的 `app-mcp.json`；桌面自动化在没有保存监听设置时可用 `SERVERBOX_MCP_POLICY` 指定其他文件）。每次请求都会重新读取注册表，因此可以手动编辑：

```json
{
  "policy": {
    "scopes": ["read", "exec", "service"],
    "commands": { "mode": "allow_all", "deny": ["rm -rf *"] }
  },
  "tokens": [
    {
      "id": "<token 的小写 BLAKE3 摘要>",
      "name": "Desktop",
      "scopes": ["read"],
      "commands": { "mode": "allowlist", "allow": ["uptime", "df *"] },
      "created_at": 0
    }
  ]
}
```

省略 `scopes` 表示拥有全部 scope，包括以后版本新增的 scope。token 的权限是它自己的 scope 与 policy scope 的交集；`run_command` 需要同时通过两层命令规则。命令规则使用 Agent 的匹配语法，与 Monitor 相同。

| Scope | 工具 |
| --- | --- |
| `read` | `list`、`machine_capabilities`、`processes`、`services`、`containers`、`tmux`、`app_settings` |
| `exec` | `run_command` |
| `process` | `kill_process` |
| `service` | `service_action` |
| `container` | `container_action` |
| `settings` | `app_setting_set` |

## 工具

`list` 返回每台服务器的 id、名称、是否已连接以及连接方式（`ssh`、`monitor`、`local`）。id 是 App 内部服务器 id 的摘要。开启 **设置 → AI → 在本机执行命令** 后，列表中会包含本机。

调用经由 App 自己的连接方式到达服务器：SSH（复用已打开的连接，或按保存的配置连接，包括跳板机和 `ProxyCommand`）、Monitor 或本机。需要确认主机密钥、输入私钥 passphrase 或回答 keyboard-interactive 问题时，调用会失败，且不计入该服务器的重连次数限制；在 App 中连接这台服务器后再调用即可。

`processes`、`services`、`containers`、`tmux`、`kill_process`、`service_action` 和 `container_action` 的参数和返回结构与 Monitor 相同。`machine_capabilities` 返回服务器的平台和连接方式；App 尚未读取过该服务器时，会先探测平台。

`run_command` 接受 `host` 和 `command`，返回 `exit_code`、`stdout`、`stderr`、`truncated` 和 `timed_out`。命令在该账户自己的 shell 中执行。输出最多保留 256 KiB。App 最多等待 30 秒即返回结果并设置 `timed_out`，在连接支持时会终止命令；通过 Monitor 执行的命令可能继续运行，直到 Monitor 自己的超时。

`app_settings` 列出 App 可编辑的设置及当前值。`app_setting_set` 接受 `key` 和类型匹配的 `value`（见工具的输入 schema），写入与设置页相同的存储。例如把 `editorFontSize` 设为 `15.5`、`motionPref` 设为 `"reduce"`、`trayMetrics` 设为 `["cpu", "disk"]`，或把 `keybindings` 设为 `{"settings.search": "Ctrl+Shift+F"}`。数组和映射会整体替换原设置。

---

### Src Content Docs Zh Advanced Bmc (`docs/src/content/docs/zh/advanced/bmc.md`)

---
title: BMC（Redfish）
description: 主机无法响应时，通过带外管理访问服务器
---

:::caution[Beta]
目前只有读取功能（电源状态和传感器）在一台真实设备上验证过；电源控制尚未进行自动化验证。不同厂商和型号的支持情况仍需进一步确认。

请把电源操作当作按下远程服务器上的物理电源按钮。
:::

BMC（Baseboard Management Controller）是服务器主板上的一台小型计算机，使用独立的电源和
网络连接。即使主机关机、无响应或尚未安装操作系统，BMC 仍可能可访问。SSH 和 Monitor
依赖主机运行，因此这些情况下无法提供连接。

Server Box 通过 **Redfish** 连接 BMC。Redfish 是企业服务器使用的 HTTPS 管理 API。仅支持
IPMI 的 BMC 暂不支持。

## 可用功能

- **电源状态：**即使 SSH 和 Monitor 不可用，也能查看主机是开机还是关机。
- **硬件传感器：**读取 BMC 上报的进风口和 CPU 温度、风扇转速及机箱功耗。
- **电源控制：**开机、请求操作系统关机或重启，或直接执行电源循环和强制断电。

BMC 用于补充 SSH，不会替代常规主机连接。同一台服务器可以同时配置 SSH、Monitor 和 BMC。

## 配置 BMC

1. 打开服务器编辑页，找到 **BMC（Redfish）**。
2. 填写 BMC 地址，不要填写主机操作系统的地址。例如 `https://10.0.0.9`；只需填写协议、
   主机和端口，Redfish 路径由 App 补全。
3. 选择已有 BMC 账户，或新建账户。
4. 打开**证书**，将证书指纹（Fingerprint）与 BMC 网页端显示的数值核对，确认设备无误后再接受证书。
5. 保存服务器。

保存后，服务器详情页会显示 BMC 卡片，展示 BMC 上报的硬件状态与电源控制入口。

## BMC 账户

BMC 账户作为独立记录保存，无需在每台服务器中重复输入用户名和密码。同一机柜中的多台服务器通常共用相同的带外管理账户，修改一处即可同步生效于所有关联服务器。

账户管理位于 **设置 → BMC 账户**。每个账户旁会显示当前关联的服务器数量，修改账户信息将同步影响这些服务器。

删除 BMC 账户不会删除关联的服务器记录，服务器会保留 BMC 地址并标记为未配置账户。

## 证书验证

BMC 设备大多使用自签名证书，没有公共证书颁发机构签名。由于 BMC 拥有底层电源控制权限，关闭证书校验会让目标地址上的任意服务轻易冒充 BMC，因此 Server Box 不提供“忽略证书”选项。

应用采用类似 SSH 主机密钥的首次使用信任（TOFU）机制：

1. 首次连接时展示证书指纹。
2. 你核对 BMC 网页端的证书指纹后，手动确认信任。
3. 后续连接仅接受已绑定的证书。
4. 若证书指纹发生变化，应用会立即阻断连接并对比展示新旧指纹，要求你重新核验。

BMC 重新生成证书或升级固件后，证书指纹可能会正常变更；但中间人攻击同样会导致指纹变化。接受新证书前，请务必核实 BMC 设备的真实身份。

部分 BMC 的出厂证书可能已过期。应用会明确提示证书过期，但仍允许你在核实设备身份后手动信任。

## 电源操作

电源操作分为经过操作系统的操作和直接作用于硬件的操作：

| 操作 | 经过操作系统 | 说明 |
|---|---|---|
| 关机 | 是 | 请求操作系统关机，需要操作系统正在运行 |
| 重启 | 是 | 请求操作系统重启 |
| 开机 | 否 | 对已关机的主机执行开机 |
| 强制断电 | 否 | 直接切断电源，未保存的数据会丢失，文件系统不会正常卸载 |
| 电源循环 | 否 | 先断电，再重新上电 |

**优雅关机和优雅重启表示请求已接受，不代表操作已经完成。** App 发送请求后会轮询 BMC 上报的电源状态，而不会只相信 HTTP 成功响应。有些固件会接受请求并返回成功，但操作系统可能没有执行操作。

如果等待时间内电源状态没有变化，App 会显示“已接受”，而不是“已确认”。“已接受”表示 BMC 收到了请求；“已确认”表示 App 观察到了预期的状态变化。

不同 BMC 支持的 `ResetType` 不同。App 会读取设备声明的可用操作，只显示设备实际提供的操作；未声明的操作不会显示为按钮。

## 当前限制

当前尚未实现：

- 事件日志
- 存储清单
- 启动项覆盖
- 虚拟介质
- 通过 Monitor 中继访问 BMC

如果 BMC 位于隔离的管理网络中，手机必须能够直接路由到 BMC。Monitor 当前不能作为 BMC 的代理。

App 还没有建模物理主机和虚拟机之间的从属关系。多个虚拟机可能指向同一台物理主机的 BMC；在任意虚拟机页面执行电源操作，都会影响整台物理主机及其所有虚拟机，读取到的电源状态也是物理主机的状态。请只在物理主机上配置 BMC。

---

### Src Content Docs Zh Advanced Bulk Import (`docs/src/content/docs/zh/advanced/bulk-import.md`)

---
title: 批量导入服务器
description: 从 JSON 文件导入多个服务器配置
---

使用 JSON 文件可以一次添加多台服务器。数组中的每个对象代表一台服务器，并可包含连接方式、
分组标签和启动行为等设置。

## JSON 格式

:::danger[安全警告]
导入文件是明文文件，可能包含凭据。请勿将它放在共享目录或提交到版本控制，并在导入完成后
尽快删除。

- 优先使用已保存在 App 中的 SSH key，并通过 `pubKeyId` 引用；不要把 private key 内容写入文件。
- 如果必须在文件中填写密码或 token，请限制文件访问权限，并在导入后立即删除。
- 将导入文件加入 `.gitignore`。即使凭据是临时的，也不要提交到版本控制系统。
:::

```json
[
  {
    "name": "My Server",
    "ssh": {
      "ip": "example.com",
      "port": 22,
      "user": "root",
      "pubKeyId": ""
    },
    "tags": ["production"],
    "autoConnect": false
  }
]
```

SSH 配置位于 `ssh` 对象内。App 导出文件与导入对话框中的示例均采用这种嵌套格式。导入功能也兼容将 `ip`、`port`、`user` 等字段直接放在顶层的旧版格式（包括从 `~/.ssh/config` 转换生成的配置）。

## 字段说明

| 字段 | 必填 | 说明 |
|-------|----------|-------------|
| `name` | 是 | 在 App 中显示的服务器名称 |
| `ssh` | 否 | SSH 配置，见下表；纯 Monitor 服务器可以省略 |
| `monitorHttp` | 否 | Monitor 配置：`addr`、`fallbackAddr`（同一个 Monitor 的另一个地址，`addr` 连不上时使用）、`user`、`pwd`、`certSha256`、`allowInsecure` |
| `preferredTransport` | 否 | 同时配置 SSH 和 Monitor HTTP 时优先使用哪一个：`ssh` 或 `monitorHttp`。省略时优先 SSH |
| `tags` | 否 | 用于分组服务器的标签 |
| `autoConnect` | 否 | App 启动时自动连接 |
| `custom` | 否 | 当前服务器的附加配置，例如 `preferTempDev`、`logoUrl` |
| `pve` | 否 | Proxmox VE 配置，见下文 |
| `wolCfg` | 否 | Wake-on-LAN 配置 |
| `envs` | 否 | 环境变量，仅对 SSH 终端生效 |
| `customSystemType` | 否 | 跳过系统类型自动检测 |
| `disabledCmdTypes` | 否 | 在该服务器上跳过的状态命令 |
| `id` | 否 | 稳定的服务器 ID；省略或为空时由 App 在导入时生成 |

以下字段放在 `ssh` 对象中：

| 字段 | 必填 | 说明 |
|-------|----------|-------------|
| `ip` | 是 | 域名或 IP 地址 |
| `port` | 是 | SSH 端口，通常为 `22` |
| `user` | 是 | SSH 用户名 |
| `pwd` | 否 | 密码（不推荐，建议使用 SSH 密钥） |
| `fileTransport` | 否 | 文件传输协议：`sftp` 或 `scp`。默认为 `sftp`；不支持 SFTP 子系统的主机可使用 `scp` |
| `pubKeyId` | 否 | 应用内已保存私钥的记录 ID（非 PEM 文件路径） |
| `keyPath` | 否 | 私钥文件路径（仅桌面端使用，由 `~/.ssh/config` 导入生成，连接时直接读取该文件） |
| `identityAgent` | 否 | 提供密钥的 ssh-agent，写法同 `IdentityAgent`：`SSH_AUTH_SOCK` 或 socket 路径；Windows 上为 named pipe，写 `SSH_AUTH_SOCK` 而该变量未设置时为 `\\.\pipe\openssh-ssh-agent`。省略则不使用 agent。Linux、Windows 与 macOS |
| `forwardAgent` | 否 | 将 `identityAgent` 转发给服务器的会话，同 `ForwardAgent yes`；连接期间服务器上的 root 可用其中的密钥签名。默认为 `false` |
| `alterUrl` | 否 | 备用地址，格式为 `user@ip:port` |
| `jumpIds` | 否 | 跳板机链，按服务器 ID 依次指定 |
| `controlPath` | 否 | 该服务器 OpenSSH 主连接的 socket 路径，写法同 `ControlPath`。以它为跳板机的服务器在主连接运行时经由它连接。Linux 与 macOS |
| `proxyCommand` | 否 | ProxyCommand（移动端在内置 Linux 环境中运行，与 `jumpIds` 互斥） |

以下字段位于 `pve` 对象内：

| 字段 | 必填 | 说明 |
|-------|----------|-------------|
| `addr` | 是 | PVE Web 地址，例如 `https://127.0.0.1:8006`（主机名在服务器端解析） |
| `auth` | 否 | `token` 或 `password`，默认为 `password` |
| `tokenId` | `token` 时必填 | API 令牌 ID，格式为 `user@realm!tokenid` |
| `tokenSecret` | `token` 时必填 | 令牌密钥（属敏感凭据，请妥善保管导出文件） |
| `pwd` | 否 | `password` 模式下使用：SSH 用户在 `pam` 域下的 PVE 密码。省略时默认使用 SSH 密码 |
| `certSha256` | 否 | 受信任证书的 SHA-256 指纹（小写十六进制）。省略时首次连接会提示确认证书 |

旧版导出文件将 `pveAddr`、`pveIgnoreCert` 和 `pvePwd` 放在 `custom` 对象中，导入时会忽略。如需保留 PVE，请改写为 `pve` 对象。

每台服务器至少需配置一种连接方式。若同时省略 `ssh` 和 `monitorHttp`，导入后将无法连接该主机。

`allowInsecure` 默认为 `false`。仅在确需通过明文 HTTP 连接 Monitor 时才设为 `true`（包括连接非回环的内网 IP 地址）。此外，Monitor 还会根据自身的 `allow_insecure` 配置，单独检查敏感接口是否允许明文访问。

## 导入步骤

1. 创建 JSON 数组，并在其中填入服务器配置对象。
2. 打开 **设置 → 备份 → 导入 → 服务器**。
3. 选择 JSON 文件。
4. 核对页面显示的服务器数量并确认导入。
5. 导入完成后删除 JSON 文件及其副本。

## 示例

```json
[
  {
    "name": "Production",
    "ssh": {
      "ip": "prod.example.com",
      "port": 22,
      "user": "admin",
      "pubKeyId": "my-key"
    },
    "tags": ["production", "web"]
  },
  {
    "name": "Development",
    "ssh": {
      "ip": "dev.example.com",
      "port": 2222,
      "user": "dev",
      "pubKeyId": "dev-key"
    },
    "tags": ["development"]
  },
  {
    "name": "Behind NAT",
    "monitorHttp": {
      "addr": "https://10.0.0.5:3770",
      "user": "admin"
    },
    "tags": ["monitor"]
  }
]
```

导入后请逐一测试服务器连接，并确认服务器记录中的标签和 transport 设置符合预期。

---

### Src Content Docs Zh Advanced Custom Commands (`docs/src/content/docs/zh/advanced/custom-commands.md`)

---
title: 自定义命令
description: 在服务器详情页显示自定义命令的输出
---

你可以用自定义命令检查服务器。App 刷新状态时会执行这些命令，并将输出显示在服务器详情页。

## 存储位置

命令文件保存在各自服务器的 `~/.config/server_box/custom_cmds` 目录中。App 不会在本机另存
一份：编辑器从服务器读取文件，保存时再写回服务器。

保存修改时必须连接服务器。服务器不可达时仍可打开编辑器查看文件，但不能保存。App 和 Monitor 共用这组文件，在任一端所做的修改都会立即反映到另一端。

## 编辑命令

1. 打开服务器编辑页，选择 **自定义命令 → 编辑**。
2. 添加命令、修改名称或 Shell 内容，也可以拖动条目调整顺序。
3. 保存到服务器。

每条命令包含显示名称和 Shell 命令。显示名称会用作服务器详情页中该命令输出的标签。

保存后的命令顺序也会用于服务器详情页。可在编辑器中拖动条目来调整显示顺序。

## 特殊名称

### `server_card_top_right`

名为 `server_card_top_right` 的命令有特殊用途：输出显示在首页服务器卡片右上角，不会出现在常规自定义命令列表中。

## 编写建议

**使用绝对路径：**

```sh
/usr/local/bin/my-script.sh
```

**支持 Shell 管道：**

```sh
ps aux | sort -rk 3 | head -5
```

**格式化输出：**

```sh
uptime | awk -F'load average:' '{print $2}'
```

**尽量缩短执行时间：**建议控制在一秒内，因为每次刷新状态都会执行命令。

**限制输出量：**

```sh
tail -20 /var/log/syslog
```

## 安全性

命令使用连接账户的身份运行：SSH 连接使用 SSH 用户；Monitor 连接使用 Monitor 进程所属用户。

通过 Monitor 连接编辑命令时，请求必须使用安全传输，或明确允许 `allow_insecure`。该目录中的每个文件都是可执行代码，会在每次状态刷新时以 Monitor 用户身份运行。

尽量只使用只读命令。命令可以使用其运行账户的权限修改服务器。不要在命令中写入密码、token 或其他凭据。

## 旧版命令存储

早期版本曾将自定义命令保存在本地服务器设置中；升级后 App 会在首次连接服务器时自动将其迁移至服务器上的 `~/.config/server_box/custom_cmds` 目录。当前版本统一从该目录读写命令。

---

--- METRICS ---
- Files Extracted: 67
- Estimated Token Budget: ~125250 tokens
- Canonical Reference: https://codewiki.google/github.com/lollipopkit/flutter_server_box
