AnyBot/install/AGENT.md

61 lines
3.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 給代理程式的一鍵安裝
不要問使用者選單。先看這台是什麼,再執行一行。沒有終端機回答時一定要設 `ANYBOT_NONINTERACTIVE=1`,否則腳本會停下來等。
## 1. 看這台
```sh
curl -fsSL https://code.30cm.net/daniel.w/AnyBot/raw/branch/main/install.sh | sh -s -- --print
```
stdout 是一行 JSON:`os`、`arch`、`rust_host`、`distro`、`pm`、`desktop`、`recommended`、`server_ok`、`notes`、`one_click`。`ok: false` 就不要裝,把 `notes` 告訴使用者。
已經 clone 時:`sh install.sh --print`。Windows:`powershell -File install.ps1 -Print`。
## 2. 裝哪一種
| 要什麼 | 系統 | 一行 |
|---|---|---|
| 桌面 App | macOS(arm64、x86_64)、任何 Linux 有桌面 | `curl -fsSL …/install.sh \| sh -s -- app` |
| 手腳(操控螢幕、檔案、瀏覽器) | macOS、任何 Linux(含沒螢幕)、Windows 已登入桌面 | 見下面 |
| 伺服器(帳號+大腦+HTTPS) | 任何有 Docker 的 Linux(不限 Ubuntu) | `ANYBOT_NONINTERACTIVE=1 ANYBOT_SETUP_USER=… ANYBOT_SETUP_PASSWORD=… ANYBOT_SETUP_DOMAIN=網域 sh install.sh server` |
| 只裝編譯工具 | 同上 | `sh install.sh deps` |
Linux 套件管理員:apt、dnf、yum、pacman、zypper、apk、xbps。認不出來但已有 gcc 和 pkg-config 會繼續編譯。NixOS / Gentoo 看 `--print` 的 `notes`,進好 shell 後加 `ANYBOT_SKIP_PACKAGES=1`。
架構:macOS arm64 / x86_64;Linux x86_64、aarch64、armv7、riscv64(glibc 或 musl);Windows x64 / arm64。32 位元 x86 不支援。
## 3. 手腳(含第一次配對,不要問)
配對碼在大腦的 AnyBot 按「加一台電腦」。10 分鐘、一次。
```sh
# macOS、任何 Linux(沒螢幕會裝虛擬螢幕、openbox、AT-SPI)
ANYBOT_NONINTERACTIVE=1 curl -fsSL https://code.30cm.net/daniel.w/AnyBot/raw/branch/main/install.sh | sh -s -- hands https://你的網域 482913
```
```powershell
# Windows(操控的是登入中的桌面,不是 Session 0)
$env:ANYBOT_NONINTERACTIVE='1'
$env:ANYBOT_MODE='hands'
$env:ANYBOT_PAIR_URL='https://你的網域'
$env:ANYBOT_PAIR_CODE='482913'
irm https://code.30cm.net/daniel.w/AnyBot/raw/branch/main/install.ps1 | iex
```
配對成功後:Linux 用 systemd 使用者服務(沒有 systemd 會直接拉起 `anybot-run`);macOS 用 launchd;Windows 用工作排程器「登入時」。登出後還要跑的 Linux:`sudo loginctl enable-linger $USER`(免密碼 sudo 時安裝程式會自己做)。
## 4. 桌面的第一次金鑰(不要問)
```sh
ANYBOT_NONINTERACTIVE=1 ANYBOT_PROVIDER=openai ANYBOT_API_KEY=sk-… sh install.sh app
```
`ANYBOT_PROVIDER`:`openai`、`anthropic`、`xai`、`gemini`、`openrouter`、`opencode`、`ollama`、`custom`。自訂位址加 `ANYBOT_BASE_URL`。沒設這兩個,有終端機才會問;沒有終端機就只裝好,並把缺的變數印出來。
## 5. 不要做的事
- 不要在 WSL 裡裝了就以為能操控 Windows 視窗。WSL 是 Linux 手腳;Windows 桌面要另外跑 `install.ps1`。
- 不要在 Mac / Windows 上跑 `install.sh server`。伺服器是 Linux + Docker。
- 不要用 `set` 改安裝腳本的參數。網址和配對碼要原樣傳到 `anybot setup`。