homeagent-runner 0.4.18 → 0.4.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,36 +1,38 @@
1
- # 参考项目对比
1
+ # Reference Project Comparison
2
2
 
3
- 核对日期:2026-10-26。比较基于公开源码,而非仅依据功能宣传。
3
+ **English** · [简体中文](COMPARISON.zh-CN.md)
4
4
 
5
- 本文件是架构概览。更完整的源码核查、逐工具映射、本轮发现并修复的缺口,以及仍未实现的全部领域,见 [WebCodex 源码对照审计](WEBCODEX_CODE_AUDIT.md) 与 [192 条声明清单](webcodex-source-inventory.json)。当前实现不具备 WebCodex 的全量产品能力。
5
+ Verified 2026-10-26. This comparison is based on public source code, not merely on feature claims.
6
6
 
7
- 用户给出的 `https://github.com/better-remote-commander` 不是具体仓库地址。本实现核对并参考的是 [shahidx0x/better-remote-commander](https://github.com/shahidx0x/better-remote-commander)。如实际指向其他项目,需要重新比较。
7
+ This file is an architectural overview. For the fuller source audit, the per-tool mapping, the gaps found and fixed this round, and all domains still unimplemented, see [Source Audit](WEBCODEX_CODE_AUDIT.md) and the [192-declaration inventory](webcodex-source-inventory.json). The current implementation does not have WebCodex's full product capabilities.
8
8
 
9
- | 参考项目 | 本次核对的 main 修订 | 主要来源 |
9
+ The `https://github.com/better-remote-commander` URL supplied by the user is not a specific repository address. What this implementation checked and referenced is [shahidx0x/better-remote-commander](https://github.com/shahidx0x/better-remote-commander). If the intended target is a different project, the comparison must be redone.
10
+
11
+ | Reference project | main revision verified this round | Primary sources |
10
12
  | --- | --- | --- |
11
- | WebCodex | `4ab06a5574792a86302dcd9a13bb4214ee09cc50` | [README](https://github.com/yyjeqhc/webcodex/blob/4ab06a5574792a86302dcd9a13bb4214ee09cc50/README.zh-CN.md)、[Runner 信封](https://github.com/yyjeqhc/webcodex/blob/4ab06a5574792a86302dcd9a13bb4214ee09cc50/crates/webcodex-core/src/runner_protocol/transport.rs)、[架构](https://github.com/yyjeqhc/webcodex/blob/4ab06a5574792a86302dcd9a13bb4214ee09cc50/docs/ARCHITECTURE.md) |
12
- | Better Remote Commander | `cbe511702dd0147650353c29ac6ab1decd8afda1` | [架构及阶段记录](https://github.com/shahidx0x/better-remote-commander/blob/cbe511702dd0147650353c29ac6ab1decd8afda1/docs/architecture.md)、[协议](https://github.com/shahidx0x/better-remote-commander/blob/cbe511702dd0147650353c29ac6ab1decd8afda1/packages/shared/src/protocol.ts)、[安全说明](https://github.com/shahidx0x/better-remote-commander/blob/cbe511702dd0147650353c29ac6ab1decd8afda1/SECURITY.md) |
13
+ | WebCodex | `4ab06a5574792a86302dcd9a13bb4214ee09cc50` | [README](https://github.com/yyjeqhc/webcodex/blob/4ab06a5574792a86302dcd9a13bb4214ee09cc50/README.zh-CN.md), [Runner envelope](https://github.com/yyjeqhc/webcodex/blob/4ab06a5574792a86302dcd9a13bb4214ee09cc50/crates/webcodex-core/src/runner_protocol/transport.rs), [architecture](https://github.com/yyjeqhc/webcodex/blob/4ab06a5574792a86302dcd9a13bb4214ee09cc50/docs/ARCHITECTURE.md) |
14
+ | Better Remote Commander | `cbe511702dd0147650353c29ac6ab1decd8afda1` | [architecture and phase notes](https://github.com/shahidx0x/better-remote-commander/blob/cbe511702dd0147650353c29ac6ab1decd8afda1/docs/architecture.md), [protocol](https://github.com/shahidx0x/better-remote-commander/blob/cbe511702dd0147650353c29ac6ab1decd8afda1/packages/shared/src/protocol.ts), [security notes](https://github.com/shahidx0x/better-remote-commander/blob/cbe511702dd0147650353c29ac6ab1decd8afda1/SECURITY.md) |
13
15
 
14
- ## 架构与协议
16
+ ## Architecture and Protocol
15
17
 
16
- | 维度 | WebCodex | Better Remote Commander | HomeAgent 的选择 |
18
+ | Dimension | WebCodex | Better Remote Commander | HomeAgent's choice |
17
19
  | --- | --- | --- | --- |
18
- | 组织方式 | Rust 多 crate 的完整运行时,包含 Desktop、CLI、Server、Runner、注册表等 | TypeScript 的 relay/agent/shared,工具核心移植自 Desktop Commander | TypeScript 的 server/runner/shared,独立工具实现,降低构建成本 |
19
- | 客户端入口 | Server 认证并路由到真实开发环境,含丰富运行时工作流 | `/mcp` Streamable HTTP,OAuth discovery、DCR、PKCE | 官方 MCP SDK,固定 `/mcp`,OAuth 和具范围的 PAT |
20
- | Runner 通道 | 传输中立的注册、请求、结果、job_update 等信封;源码还定义 QUIC 帧 | 主动 WS,hello/call/result/ping/pong | 主动 WSS,版本化 hello/call/result/cancel,WS ping/pong |
21
- | 项目边界 | 项目、能力授权、任务生命周期体系更丰富 | 设备路由 + allowedDirectories + blockedCommands | 每项目独立 root/readOnly/commands/Git 写入开关,本地再次验证 |
22
- | 长任务 | Job、持久 shell、观察与会话接续等完整模型 | start_process、读取输出、进程管理 | 持久进程元数据、限额输出文件、游标读取、stdin、整组终止、归属校验 |
23
- | 运维形态 | 更全面,但组件、构建与原生安装验收更复杂 | SQLite、Compose、Dashboard、反代/隧道、自启动 | SQLite 单节点、Compose、原生 Runner、Caddy/Nginx、可选隧道 |
24
- | 工具覆盖 | 强调真实项目开发流程与可审查工作结果 | Desktop Commander 的文件、搜索、编辑、终端能力更广,还含非核心文档功能 | 直接使用实用工具名,覆盖本需求文件/终端/Git,不引入 PDF/浏览器下载依赖 |
20
+ | Organization | A full Rust multi-crate runtime including Desktop, CLI, Server, Runner, and registry | TypeScript relay/agent/shared, with the tool core ported from Desktop Commander | TypeScript server/runner/shared with an independent tool implementation, lowering build cost |
21
+ | Client entry point | Server authenticates and routes to a real dev environment, with rich runtime workflows | `/mcp` Streamable HTTP, OAuth discovery, DCR, PKCE | Official MCP SDK, fixed `/mcp`, OAuth and scoped PAT |
22
+ | Runner channel | Transport-neutral registration/request/result/job_update envelopes; the source also defines QUIC frames | Proactive WS, hello/call/result/ping/pong | Proactive WSS, versioned hello/call/result/cancel, WS ping/pong |
23
+ | Project boundary | A richer system of projects, capability grants, and job lifecycle | Device routing + allowedDirectories + blockedCommands | Per-project independent root/readOnly/commands/Git write switch, re-validated locally |
24
+ | Long jobs | A fuller model of jobs, persistent shells, observation, and session resumption | start_process, output reads, process management | Persistent process metadata, bounded output files, cursor reads, stdin, whole-group termination, ownership checks |
25
+ | Operations footprint | More comprehensive, but with more complex components, builds, and native-install acceptance | SQLite, Compose, Dashboard, reverse proxy/tunnel, autostart | Single-node SQLite, Compose, native Runner, Caddy/Nginx, optional tunnel |
26
+ | Tool coverage | Emphasizes real project development workflows and reviewable work results | Desktop Commander's broader file, search, edit, terminal capabilities, plus non-core document features | Uses pragmatic tool names directly, covering the file/terminal/Git needs of this project; now 51 tools including fuzzy diffs, persistent shell sessions, and lightweight LSP, but still not full parity — no PDF/browser-download dependencies are introduced |
25
27
 
26
- WebCodex 的优势是开发任务的上下文、生命周期和项目治理比较完整,适合持续运行与审查。代价是系统规模更大,原生构建和平台安装面更广;其 README 本身也明确区分安装交付目标与尚待完成的真实平台验收,不能把计划能力当作已验证能力。HomeAgent 吸收项目边界、Runner 主动连接、长任务观察、多设备与审计,但不重建它的 Desktop、工作流会话和 QUIC 栈。
28
+ WebCodex's strengths are fairly complete context, lifecycle, and project governance for development tasks, suited to sustained running and review. The cost is a larger system with a wider native-build and platform-install surface; its README itself explicitly distinguishes install-delivery targets from real platform acceptance still to be done, so planned capabilities must not be treated as verified ones. HomeAgent absorbs project boundaries, proactive Runner connection, long-job observation, multi-device support, and auditing, but does not rebuild its Desktop, workflow sessions, or QUIC stack.
27
29
 
28
- BRC 的优势是轻量、工具实用,OAuth、配对和 Dashboard 与远程 MCP 的常见接入需求贴合。代价是移植工具核心的依赖与维护负担;它的阶段记录提到 PDF 工具存在首次使用下载 Chrome 的行为。它使用目录限制与命令阻止表,这种策略不能自动隔离可执行的解释器和构建脚本。HomeAgent 采用默认空的可执行文件允许列表,不提供远程修改本机策略的工具。
30
+ BRC's strengths are being lightweight with practical tools; its OAuth, pairing, and Dashboard fit the common integration needs of remote MCP. The cost is the dependency and maintenance burden of a ported tool core; its phase notes mention that PDF tools download Chrome on first use. It uses directory restrictions and a command-block table, a policy that cannot automatically isolate executable interpreters and build scripts. HomeAgent uses a default-empty executable allowlist and offers no tool for remotely changing local policy.
29
31
 
30
- ## 安全结论与兼容边界
32
+ ## Security Conclusions and Compatibility Boundaries
31
33
 
32
- 两种项目都把 Runner/Agent 作为执行实际系统操作的信任主体。主动连出解决 NAT 和入站暴露问题,不会减少一个获准执行命令的 AI 客户端本身拥有的操作权限。
34
+ Both projects treat the Runner/Agent as the trusted principal that performs real system operations. Proactive outbound connection solves NAT and inbound-exposure problems; it does not reduce the operating privileges that an AI client authorized to run commands already has on its own.
33
35
 
34
- HomeAgent 的 Server 协议是标准 MCP;Runner 信封是项目自己的内部协议,不与 WebCodex 或 BRC 的 Runner 二进制互通。工具命名参考 Desktop Commander 常用语义,参数刻意增加 `projectId`、权限与进程归属,也不宣称与其全部工具逐参数兼容。
36
+ HomeAgent's Server protocol is standard MCP; the Runner envelope is this project's own internal protocol and is not binary-interoperable with WebCodex's or BRC's Runner. Tool naming follows common Desktop Commander semantics, with `projectId`, permissions, and process ownership deliberately added to parameters, and no claim of full per-parameter compatibility with all of its tools.
35
37
 
36
- 本项目仅借鉴架构与行为设计,代码独立编写。没有将第三方遥测、云中继或托管配对服务引入运行链路。
38
+ This project borrows only architecture and behavioral design; the code is written independently. No third-party telemetry, cloud relay, or hosted pairing service has been introduced into the runtime pipeline.
@@ -0,0 +1,38 @@
1
+ # 参考项目对比
2
+
3
+ [English](COMPARISON.md) · **简体中文**
4
+
5
+ 核对日期:2026-10-26。比较基于公开源码,而非仅依据功能宣传。
6
+
7
+ 本文件是架构概览。更完整的源码核查、逐工具映射、本轮发现并修复的缺口,以及仍未实现的全部领域,见 [WebCodex 源码对照审计](WEBCODEX_CODE_AUDIT.zh-CN.md) 与 [192 条声明清单](webcodex-source-inventory.json)。当前实现不具备 WebCodex 的全量产品能力。
8
+
9
+ 用户给出的 `https://github.com/better-remote-commander` 不是具体仓库地址。本实现核对并参考的是 [shahidx0x/better-remote-commander](https://github.com/shahidx0x/better-remote-commander)。如实际指向其他项目,需要重新比较。
10
+
11
+ | 参考项目 | 本次核对的 main 修订 | 主要来源 |
12
+ | --- | --- | --- |
13
+ | WebCodex | `4ab06a5574792a86302dcd9a13bb4214ee09cc50` | [README](https://github.com/yyjeqhc/webcodex/blob/4ab06a5574792a86302dcd9a13bb4214ee09cc50/README.zh-CN.md)、[Runner 信封](https://github.com/yyjeqhc/webcodex/blob/4ab06a5574792a86302dcd9a13bb4214ee09cc50/crates/webcodex-core/src/runner_protocol/transport.rs)、[架构](https://github.com/yyjeqhc/webcodex/blob/4ab06a5574792a86302dcd9a13bb4214ee09cc50/docs/ARCHITECTURE.md) |
14
+ | Better Remote Commander | `cbe511702dd0147650353c29ac6ab1decd8afda1` | [架构及阶段记录](https://github.com/shahidx0x/better-remote-commander/blob/cbe511702dd0147650353c29ac6ab1decd8afda1/docs/architecture.md)、[协议](https://github.com/shahidx0x/better-remote-commander/blob/cbe511702dd0147650353c29ac6ab1decd8afda1/packages/shared/src/protocol.ts)、[安全说明](https://github.com/shahidx0x/better-remote-commander/blob/cbe511702dd0147650353c29ac6ab1decd8afda1/SECURITY.md) |
15
+
16
+ ## 架构与协议
17
+
18
+ | 维度 | WebCodex | Better Remote Commander | HomeAgent 的选择 |
19
+ | --- | --- | --- | --- |
20
+ | 组织方式 | Rust 多 crate 的完整运行时,包含 Desktop、CLI、Server、Runner、注册表等 | TypeScript 的 relay/agent/shared,工具核心移植自 Desktop Commander | TypeScript 的 server/runner/shared,独立工具实现,降低构建成本 |
21
+ | 客户端入口 | Server 认证并路由到真实开发环境,含丰富运行时工作流 | `/mcp` Streamable HTTP,OAuth discovery、DCR、PKCE | 官方 MCP SDK,固定 `/mcp`,OAuth 和具范围的 PAT |
22
+ | Runner 通道 | 传输中立的注册、请求、结果、job_update 等信封;源码还定义 QUIC 帧 | 主动 WS,hello/call/result/ping/pong | 主动 WSS,版本化 hello/call/result/cancel,WS ping/pong |
23
+ | 项目边界 | 项目、能力授权、任务生命周期体系更丰富 | 设备路由 + allowedDirectories + blockedCommands | 每项目独立 root/readOnly/commands/Git 写入开关,本地再次验证 |
24
+ | 长任务 | Job、持久 shell、观察与会话接续等完整模型 | start_process、读取输出、进程管理 | 持久进程元数据、限额输出文件、游标读取、stdin、整组终止、归属校验 |
25
+ | 运维形态 | 更全面,但组件、构建与原生安装验收更复杂 | SQLite、Compose、Dashboard、反代/隧道、自启动 | SQLite 单节点、Compose、原生 Runner、Caddy/Nginx、可选隧道 |
26
+ | 工具覆盖 | 强调真实项目开发流程与可审查工作结果 | Desktop Commander 的文件、搜索、编辑、终端能力更广,还含非核心文档功能 | 直接使用实用工具名,覆盖本需求文件/终端/Git;当前共 51 个工具,含模糊 diff、持久 Shell 会话与轻量 LSP,但仍非全量对等——不引入 PDF/浏览器下载依赖 |
27
+
28
+ WebCodex 的优势是开发任务的上下文、生命周期和项目治理比较完整,适合持续运行与审查。代价是系统规模更大,原生构建和平台安装面更广;其 README 本身也明确区分安装交付目标与尚待完成的真实平台验收,不能把计划能力当作已验证能力。HomeAgent 吸收项目边界、Runner 主动连接、长任务观察、多设备与审计,但不重建它的 Desktop、工作流会话和 QUIC 栈。
29
+
30
+ BRC 的优势是轻量、工具实用,OAuth、配对和 Dashboard 与远程 MCP 的常见接入需求贴合。代价是移植工具核心的依赖与维护负担;它的阶段记录提到 PDF 工具存在首次使用下载 Chrome 的行为。它使用目录限制与命令阻止表,这种策略不能自动隔离可执行的解释器和构建脚本。HomeAgent 采用默认空的可执行文件允许列表,不提供远程修改本机策略的工具。
31
+
32
+ ## 安全结论与兼容边界
33
+
34
+ 两种项目都把 Runner/Agent 作为执行实际系统操作的信任主体。主动连出解决 NAT 和入站暴露问题,不会减少一个获准执行命令的 AI 客户端本身拥有的操作权限。
35
+
36
+ HomeAgent 的 Server 协议是标准 MCP;Runner 信封是项目自己的内部协议,不与 WebCodex 或 BRC 的 Runner 二进制互通。工具命名参考 Desktop Commander 常用语义,参数刻意增加 `projectId`、权限与进程归属,也不宣称与其全部工具逐参数兼容。
37
+
38
+ 本项目仅借鉴架构与行为设计,代码独立编写。没有将第三方遥测、云中继或托管配对服务引入运行链路。
@@ -1,16 +1,18 @@
1
- # 部署、配对与运维
1
+ # Deployment, Pairing, and Operations
2
2
 
3
- ## 准备
3
+ **English** · [简体中文](DEPLOYMENT.zh-CN.md)
4
4
 
5
- 推荐 Node.js 24.22.1 或更新的 24 LTS 补丁版、Git;最低 Node 24.14。原生 Server 不需要额外数据库。容器方式需要 Docker Engine 和 Compose v2。Runner 建议原生运行在开发机器上,以便使用现有编译器和工具链。
5
+ ## Preparation
6
6
 
7
- 所有公网流量使用 HTTPS/WSS。Server 的 `PUBLIC_URL` 必须是稳定、无子路径的外部 origin,例如 `https://mcp.example.com`。不要用每次重启会变化的临时隧道地址做长期 OAuth issuer。
7
+ We recommend Node.js 24.22.1 or a newer 24 LTS patch release, plus Git; the minimum supported version is Node 24.14. A native Server needs no additional database. The container path requires Docker Engine and Compose v2. The Runner is best installed natively on the development machine so it can use the existing compilers and toolchain.
8
8
 
9
- ## 原生部署 Server
9
+ All public traffic must use HTTPS/WSS. The Server's `PUBLIC_URL` must be a stable external origin without a subpath, for example `https://mcp.example.com`. Do not use a temporary tunnel address that changes on every restart as a long-term OAuth issuer.
10
10
 
11
- ### npm 安装
11
+ ## Native Server Deployment
12
12
 
13
- Server 和 Runner 使用独立 npm 包,无需源码编译。Server 包包含 Web Dashboard:
13
+ ### npm installation
14
+
15
+ The Server and Runner are separate npm packages; no source build is required. The Server package includes the Web Dashboard:
14
16
 
15
17
  ```sh
16
18
  npm install -g homeagent-server@latest
@@ -19,15 +21,15 @@ cd homeagent-server
19
21
  homeagent-server init
20
22
  ```
21
23
 
22
- 编辑本目录 `.env`,保留生成的密码和会话密钥。本机验证使用默认 `http://localhost:3210`;公网修改 `PUBLIC_URL=https://mcp.example.com`,若只有一层可信反代则设 `TRUST_PROXY_HOPS=1`,由反代连接 `127.0.0.1:3210`。然后运行:
24
+ Edit the `.env` in this directory and keep the generated password and session secret. For local verification use the default `http://localhost:3210`; for public access set `PUBLIC_URL=https://mcp.example.com` and, when there is exactly one trusted reverse proxy, `TRUST_PROXY_HOPS=1`, with the proxy connecting to `127.0.0.1:3210`. Then run:
23
25
 
24
26
  ```sh
25
27
  homeagent-server
26
28
  ```
27
29
 
28
- 命令在前台运行,从当前目录读取 `.env`;已有环境变量优先于文件。数据库默认写入当前目录的 `data/server.sqlite`,因此服务管理器必须设置固定工作目录。Linux 和 Windows PowerShell 的安装/启动命令相同。
30
+ The command runs in the foreground and reads `.env` from the current directory; existing environment variables take precedence over the file. The database is written by default to `data/server.sqlite` in the current directory, so the service manager must set a fixed working directory. The install and launch commands are identical on Linux and in Windows PowerShell.
29
31
 
30
- ### 从源码安装
32
+ ### Installing from source
31
33
 
32
34
  ```sh
33
35
  git clone https://github.com/jhxxr/HomeAgent.git
@@ -37,17 +39,17 @@ npm run build
37
39
  npm run init
38
40
  ```
39
41
 
40
- 用编辑器查看 `.env` 中生成的管理员密码,并修改 `PUBLIC_URL`。同机开发时保留 `http://localhost:3210`;对外部署时设为自己的 HTTPS 域名,反向代理连接本地 `127.0.0.1:3210`。非 loopback 的 HTTP PUBLIC_URL 会被拒绝。
42
+ Open `.env` in an editor to see the generated administrator password and to edit `PUBLIC_URL`. For same-machine development keep `http://localhost:3210`; for public deployment set your own HTTPS domain and reverse-proxy to local `127.0.0.1:3210`. A non-loopback HTTP `PUBLIC_URL` is rejected.
41
43
 
42
44
  ```sh
43
45
  npm run server
44
46
  ```
45
47
 
46
- 生产由自己的服务管理器运行 `node dist/server/cli.js`,并安全注入 `.env`。npm 脚本使用 Node 的 `--env-file-if-exists=.env`,直接运行 node 则需要显式 `--env-file=/绝对路径/.env` 或服务环境。
48
+ In production, use your own service manager to run `node dist/server/cli.js` and inject `.env` securely. The npm scripts use Node's `--env-file-if-exists=.env`; invoking `node` directly requires an explicit `--env-file=/absolute/path/.env` or a service environment.
47
49
 
48
- ### Linux 用户 systemd 服务
50
+ ### Linux user systemd service
49
51
 
50
- 以下针对 npm 安装方式,在运行 Server 的专用低权限账户下操作。先确认实际路径:
52
+ The following applies to the npm installation method, under the dedicated low-privilege account that runs the Server. First confirm the actual paths:
51
53
 
52
54
  ```sh
53
55
  command -v node
@@ -55,11 +57,11 @@ npm root -g
55
57
  mkdir -p "$HOME/.config/systemd/user"
56
58
  ```
57
59
 
58
- 创建 `$HOME/.config/systemd/user/homeagent-server.service`,把下面三个路径替换为自己的实际值:
60
+ Create `$HOME/.config/systemd/user/homeagent-server.service`, replacing the three paths below with your real values:
59
61
 
60
- - `WorkingDirectory`:保存 `.env` 的目录,必须允许该账户写入数据库。
61
- - `ExecStart` 第一个路径:`command -v node` 的输出。
62
- - `ExecStart` 第二个路径:`npm root -g` 输出目录下的 `homeagent-server/bin/server.mjs`。
62
+ - `WorkingDirectory`: the directory holding `.env`, which must be writable by that account for the database.
63
+ - `ExecStart` first path: the output of `command -v node`.
64
+ - `ExecStart` second path: `homeagent-server/bin/server.mjs` under the `npm root -g` output directory.
63
65
 
64
66
  ```ini
65
67
  [Unit]
@@ -79,7 +81,7 @@ NoNewPrivileges=yes
79
81
  WantedBy=default.target
80
82
  ```
81
83
 
82
- 路径含空格时,分别使用 systemd 支持的双引号包住 `WorkingDirectory` 和 `ExecStart` 各路径;unit 中不能依赖 shell 的 `~` 或变量展开。
84
+ When a path contains spaces, wrap each `WorkingDirectory` and `ExecStart` path in the double quotes supported by systemd; a unit cannot rely on shell `~` or variable expansion.
83
85
 
84
86
  ```sh
85
87
  systemctl --user daemon-reload
@@ -88,18 +90,18 @@ systemctl --user status homeagent-server
88
90
  journalctl --user -u homeagent-server -f
89
91
  ```
90
92
 
91
- 若需退出登录后继续运行并随系统启动,由管理员为该账户执行 `sudo loginctl enable-linger <运行账户>`。更新 npm 包后执行 `systemctl --user restart homeagent-server`。Windows 长期运行时使用自己的服务/进程管理器,指定相同工作目录;`homeagent service-install` 只安装 Runner 自启动,不安装 Server 服务。
93
+ To keep running after logout and to start at boot, an administrator should run `sudo loginctl enable-linger <service-account>` for that account. After updating the npm package, run `systemctl --user restart homeagent-server`. For long-running Windows deployments use your own service/process manager with the same fixed working directory; `homeagent service-install` installs Runner autostart only, not a Server service.
92
94
 
93
95
  ## Docker Compose
94
96
 
95
- 先在有 Docker Engine、Compose v2 和 Git 的服务器检出发布源码:
97
+ Check out the release source on a server with Docker Engine, Compose v2 and Git:
96
98
 
97
99
  ```sh
98
- git clone --branch v0.4.11 --depth 1 https://github.com/jhxxr/HomeAgent.git
100
+ git clone --branch v0.4.20 --depth 1 https://github.com/jhxxr/HomeAgent.git
99
101
  cd HomeAgent
100
102
  ```
101
103
 
102
- Linux 主机可通过容器生成 `.env`,无需宿主机 Node.js;按当前 UID/GID 创建文件,避免密钥归 root 所有导致普通账户无法编辑:
104
+ On a Linux host you can generate `.env` through a container without Node.js on the host; the file is created with the current UID/GID so it is not owned by root and uneditable by a normal account:
103
105
 
104
106
  ```sh
105
107
  docker run --rm --user "$(id -u):$(id -g)" \
@@ -107,7 +109,7 @@ docker run --rm --user "$(id -u):$(id -g)" \
107
109
  node:24.22.1-bookworm-slim node scripts/init.mjs
108
110
  ```
109
111
 
110
- 如果宿主机已有 Node.js,也可以直接执行 `node scripts/init.mjs`。初始化均不覆盖已有 `.env`。默认本地模式启动:
112
+ If the host already has Node.js, run `node scripts/init.mjs` directly. Initialization never overwrites an existing `.env`. Start in default local mode:
111
113
 
112
114
  ```sh
113
115
  docker compose up -d --build
@@ -115,13 +117,13 @@ docker compose ps
115
117
  docker compose logs --tail=100 server
116
118
  ```
117
119
 
118
- 默认仅将 `127.0.0.1:3210` 映射到容器,不直接向公网暴露明文端口。SQLite 保存在 `server-data` 命名卷。Server 非 root 运行,根文件系统只读,只有数据库卷与临时目录可写,去除所有 Linux capabilities。
120
+ By default only `127.0.0.1:3210` is mapped to the container; the plaintext port is never exposed directly to the public internet. SQLite lives in the `server-data` named volume. The Server runs as non-root with a read-only root filesystem, only the database volume and temp directory writable, and all Linux capabilities dropped.
119
121
 
120
- Docker 镜像包含已经编译的生产依赖、Dashboard 静态文件;运行不需要 npm、第三方 API 或构建服务。镜像构建需要访问软件包和镜像仓库,离线环境可在有网环境构建、导出镜像后导入。
122
+ The image contains compiled production dependencies and Dashboard static assets; runtime needs no npm, third-party API or build service. Building the image requires access to package and image registries; offline environments can build on a connected host, export the image and import it.
121
123
 
122
- ### Caddy 自动 TLS
124
+ ### Automatic TLS with Caddy
123
125
 
124
- 域名 A/AAAA 指向自己的 Server,放行 80/443。在 `.env` 修改:
126
+ Point the domain A/AAAA records at your Server and open ports 80/443. In `.env` set:
125
127
 
126
128
  ```dotenv
127
129
  PUBLIC_URL=https://mcp.example.com
@@ -133,115 +135,115 @@ TRUST_PROXY_HOPS=1
133
135
  docker compose --profile proxy up -d --build
134
136
  ```
135
137
 
136
- Caddy 自动申请 TLS 并代理 HTTP 和 WebSocket。服务器与 Runner 都走同一个域名,Runner 指向 `https://mcp.example.com`。客户端 MCP URL 为 `https://mcp.example.com/mcp`。
138
+ Caddy automatically provisions TLS and proxies HTTP and WebSocket traffic. Both the Server and the Runner use the same domain; the Runner points to `https://mcp.example.com`. The client MCP URL is `https://mcp.example.com/mcp`.
137
139
 
138
- ### 已有 Nginx
140
+ ### Existing Nginx
139
141
 
140
- 参考 [deploy/nginx.conf](../deploy/nginx.conf),证书自行配置。`Host` 必须保持外部域名;必须支持 WebSocket upgrade,关闭代理缓冲。将 `TRUST_PROXY_HOPS=1` 设为真实受信代理数量,不能无条件信任任意 X-Forwarded-For。
142
+ See [deploy/nginx.conf](../deploy/nginx.conf) and configure certificates yourself. `Host` must remain the external domain; WebSocket upgrade must be supported and proxy buffering disabled. Set `TRUST_PROXY_HOPS=1` to the real number of trusted proxies and never trust arbitrary `X-Forwarded-For` unconditionally.
141
143
 
142
- ### 可选 Cloudflare Tunnel
144
+ ### Optional Cloudflare Tunnel
143
145
 
144
- 它是可选部署方式,会让流量通过 Cloudflare;完全自控的部署请选择自有服务器和反向代理。
146
+ This is an optional deployment that routes traffic through Cloudflare; for a fully self-controlled setup use your own server and reverse proxy.
145
147
 
146
- 在自己已有的命名 Tunnel 中配置固定 hostname `mcp.example.com`,目标 `http://server:3210`(cloudflared 容器与 server 同网络)。`.env` 设置:
148
+ In an existing named Tunnel, configure a fixed hostname `mcp.example.com` targeting `http://server:3210` (the cloudflared container shares the Server network). In `.env` set:
147
149
 
148
150
  ```dotenv
149
151
  PUBLIC_URL=https://mcp.example.com
150
152
  TRUST_PROXY_HOPS=1
151
- CLOUDFLARE_TUNNEL_TOKEN=你的命名隧道凭据
153
+ CLOUDFLARE_TUNNEL_TOKEN=your-named-tunnel-credential
152
154
  ```
153
155
 
154
156
  ```sh
155
157
  docker compose --profile cloudflare up -d --build
156
158
  ```
157
159
 
158
- 不要同时用 Cloudflare Access 的交互登录拦截 `/mcp`、OAuth 元数据或 `/runner`,除非客户端明确支持额外认证。此项目不依赖隧道,也不保存任何 Cloudflare API 凭据到源码。
160
+ Do not use Cloudflare Access interactive login to intercept `/mcp`, OAuth metadata or `/runner` unless the client explicitly supports the extra authentication. This project does not depend on a tunnel and stores no Cloudflare API credentials in source.
159
161
 
160
- ## Runner 配置与配对
162
+ ## Runner Configuration and Pairing
161
163
 
162
- 在开发机执行 `npm install -g homeagent-runner@latest`,之后直接执行 `homeagent`。未登录时进入全屏欢迎页,按 Enter 填写 Server URL 和设备名;等待批准时按 `o` 打开浏览器,项目目录在网页填写并保存在 Server 上。批准后自动连接。已登录时再次执行 `homeagent` 直接进入运行总览,无需记忆登录或启动子命令。新 Runner 本地配置只保存连接和运行设置,`stateDir` 保存凭据与任务记录;没有本地项目基线。
164
+ On the development machine run `npm install -g homeagent-runner@latest`, then simply `homeagent`. When not logged in, a full-screen welcome page appears; press Enter to enter the Server URL and device name. While waiting for approval press `o` to open the browser; project directories are entered on the web page and stored on the Server. The connection is established automatically after approval. When already logged in, running `homeagent` again goes straight to the run overview, with no need to remember a login or start subcommand. A new Runner's local config holds only connection and runtime settings; `stateDir` holds credentials and job records, with no local project baseline.
163
165
 
164
- 成功登录和启动会记录配置的绝对路径,换工作目录后仍可使用 `homeagent`。指定 `--config` 时以显式路径为准,否则依次检查已记录位置、`~/.homeagent/runner.json`。已记录的文件被移动或删除时,全屏界面保留错误提示,允许用户选择配置,避免静默连接另一台设备。按 `s` 打开设置,可修改设备名、并发数、输出与历史上限,选择配置、重新登录、切换服务、启停自启动和退出登录;按 `a` 查看活动,`o` 打开网页,`p` 暂停/恢复连接。修改运行设置会先确认再断线、停止托管任务并重连。启用自启动前会关闭前台 Runner,由后台实例接管;服务固定使用当前配置路径。
166
+ Successful login and startup record the absolute config path, so `homeagent` still works after changing the working directory. With `--config` the explicit path wins; otherwise the recorded location is checked first, then `~/.homeagent/runner.json`. If the recorded file was moved or deleted, the full-screen UI keeps an error message and lets the user pick a config, so it never silently connects to another device. Press `s` for Settings to change the device name, concurrency, output and history limits, choose a config, re-login, switch service, toggle autostart and log out; press `a` for Activity, `o` to open the web page, `p` to pause/resume the connection. Changing runtime settings first asks for confirmation, then disconnects, stops hosted jobs and reconnects. Enabling autostart closes the foreground Runner and hands over to the background instance; the service is pinned to the current config path.
165
167
 
166
- 本地配置仅包含连接和运行设置,例如:
168
+ The local config contains only connection and runtime settings, for example:
167
169
 
168
170
  ```json
169
171
  {"server":"https://mcp.example.com","name":"workstation","stateDir":"state"}
170
172
  ```
171
173
 
172
- 项目目录、Git 权限、命令别名和环境配置全部在网页管理。本地配置不接受项目字段或权限开关,Server 与 Runner 必须同时升级。
174
+ Project directories, Git permissions, command aliases and environment profiles are all managed on the web page. The local config accepts no project fields or permission switches, and Server and Runner must be upgraded together.
173
175
 
174
- ### Dashboard 权限管理
176
+ ### Dashboard permission management
175
177
 
176
- Runner 首次连接时没有项目权限,收到 Server 配置并验证成功后才开放项目。Dashboard 的设备编辑器可以为每个项目设置:
178
+ A Runner has no project permissions on first connect; projects open only after it receives and successfully validates the Server configuration. The Dashboard device editor can set, per project:
177
179
 
178
- - `filesystemScope=project`:只允许内置文件工具访问项目目录;
179
- - `filesystemScope=device`:允许使用设备范围的绝对路径,但 Runner 配置、stateDir 和受保护路径仍拒绝通过文件工具访问;
180
- - `commandMode=allowlist`:只允许运行网页配置的 `commands` 或别名;
181
- - `commandMode=unrestricted`:允许任意可执行文件,实际权限等于 Runner 运行账户;
182
- - Git 本地写入、网络 fetch/pull 和 push 三个独立开关。
180
+ - `filesystemScope=project`: built-in file tools may access only the project directory;
181
+ - `filesystemScope=device`: device-wide absolute paths are allowed, but Runner configuration, `stateDir` and protected paths are still refused through file tools;
182
+ - `commandMode=allowlist`: only `commands` or aliases configured on the web page may run;
183
+ - `commandMode=unrestricted`: any executable may run, with privileges equal to the Runner account;
184
+ - Three independent switches for local Git writes, network fetch/pull and push.
183
185
 
184
- 客户端授权编辑器另外控制设备、项目、scope、具体工具,以及直接显示的“允许全部程序”和“允许使用设备范围的绝对路径”开关。设备上限与客户端授权取交集,因此打开设备级能力不会自动让所有客户端获得该能力。修改已有 PAT 或 OAuth 授权不需要重新复制令牌。
186
+ The client authorization editor separately controls devices, projects, scopes, individual tools, and the visible "Allow all programs" and "Allow device-wide absolute paths" toggles. The device ceiling and the client authorization are intersected, so enabling a device-level capability does not automatically grant it to every client. Editing an existing PAT or OAuth authorization does not require copying the token again.
185
187
 
186
- 要运行电脑上其他 Python/Conda 环境,无需逐个填写“允许的程序”:在设备项目的“允许执行的程序”中选择“允许全部程序”,并在当前使用的客户端授权中勾选“允许全部程序”(同时开启执行任务权限)。解释器使用绝对路径,例如 `D:\Conda\envs\eeg\python.exe`;执行参数单独传入 `args`。若工作目录 `cwd` 位于项目外,还需在设备项目选择设备范围的绝对路径,并在当前客户端授权中允许同一能力。“全设备”文件范围不会自动开放全部程序。
188
+ To use other Python/Conda environments on the machine you need not list every "allowed program": in the device project's "Allowed programs" choose "Allow all programs", and in the client authorization currently in use also check "Allow all programs" (with execute permission enabled). Use an absolute interpreter path such as `D:\Conda\envs\eeg\python.exe` and pass arguments separately in `args`. If the working directory `cwd` lies outside the project, also select device-wide absolute paths in the device project and allow the same capability in the current client authorization. Device-wide file scope does not by itself open all programs.
187
189
 
188
- `list_devices` 和 `get_project_context` 返回当前客户端的有效权限;`executionPolicy`、`filesystemPolicy` 同时说明设备配置与客户端授权。若 `limitedBy=authorization`,应修改当前客户端授权;若为 `project`,应修改设备项目设置。Dashboard 的设备编辑器仍显示设备配置上限。保存设备设置后等待页面显示 Runner 已应用,再发起新的调用。
190
+ `list_devices` and `get_project_context` return the effective permissions for the current client; `executionPolicy` and `filesystemPolicy` explain both the device configuration and the client authorization. If `limitedBy=authorization`, edit the current client authorization; if `project`, edit the device project settings. The Dashboard device editor still shows the device configuration ceiling. After saving device settings, wait until the page shows the Runner has applied them before issuing new calls.
189
191
 
190
- 设备和客户端授权都支持临时有效分钟数。到期时 Server 增加 revision、取消在途调用;Runner 会停止该授权启动的托管任务,并恢复上一个永久权限。权限修改使用 `expectedRevision`,浏览器打开过期编辑器时会收到冲突而不会覆盖新设置。保存设备权限会停止此设备的托管任务,已发生的文件修改不会回滚。
192
+ Both device and client authorizations support temporary minute-level durations. On expiry the Server increments the revision and cancels in-flight calls; the Runner stops hosted jobs started by that authorization and restores the previous permanent permissions. Permission edits use `expectedRevision`, so a browser with a stale editor gets a conflict instead of overwriting newer settings. Saving device permissions stops hosted jobs on that device; file edits already made are not rolled back.
191
193
 
192
- 设备项目设置只有 Server 一个来源。清空全部项目后收回访问;断线会清空运行中的项目列表并停止托管任务,重连后重新下发。Server 仅接受当前 Runner 协议。
194
+ Device project settings have a single source: the Server. Clearing all projects revokes access; a disconnect clears the in-memory project list and stops hosted jobs, and the Server re-delivers them on reconnect. The Server accepts only the current Runner protocol.
193
195
 
194
- 交互式登录流程:
196
+ Interactive login flow:
195
197
 
196
- 1. 执行 `homeagent`,在全屏欢迎页按 Enter 登录,填写服务地址与设备名;创建私有配置并通过出站 HTTPS 请求创建配对。
197
- 2. 全屏等待页显示 10 分钟有效的浏览器链接和备用 10 位一次性码,按 `o` 打开浏览器,Esc 取消,Ctrl+C 退出。
198
- 3. 在已经登录 Server Dashboard 的浏览器打开链接,核对设备名称、填写被控端项目的绝对目录并批准;也可以稍后在 Dashboard 配置项目。备用码流程继续可用。
199
- 4. Runner 使用自己持有的独立 pollToken 领取长期设备凭据。码、pollToken 和浏览器批准凭据都不能用来直接取得另一台设备的凭据。
200
- 5. 凭据保存到 stateDir/device.json;Linux 目录 0700、文件 0600,Windows CLI 对目录设置当前账户和 SYSTEM 的受限 ACL。配对与运行使用同一 stateDir 互斥锁;先停止正在运行的实例再重新配对。
201
- 6. 登录完成后自动进入运行总览;Dashboard 应显示在线及注册项目,最近活动中显示当前生效目录。下次仍直接执行 `homeagent`。
198
+ 1. Run `homeagent`, press Enter on the full-screen welcome page to log in, and enter the service address and device name; a private config is created and a pairing is created over outbound HTTPS.
199
+ 2. The full-screen waiting page shows a 10-minute browser link and a fallback 10-character one-time code; press `o` to open the browser, Esc to cancel, Ctrl+C to exit.
200
+ 3. In a browser already signed in to the Server Dashboard, open the link, verify the device name, enter the absolute directory of the hosted project and approve; projects can also be configured later in the Dashboard. The fallback code flow remains available.
201
+ 4. The Runner uses its own independent `pollToken` to claim the long-lived device credential. Neither the code, nor the pollToken, nor the browser approval credential can be used to obtain another device's credential.
202
+ 5. Credentials are saved to `stateDir/device.json`; on Linux the directory is 0700 and files 0600, on Windows the CLI sets a restricted ACL for the current account and SYSTEM. Pairing and running share the same `stateDir` mutex; stop a running instance before re-pairing.
203
+ 6. After login the run overview appears automatically; the Dashboard should show the device online and its registered projects, with the effective directories in Recent Activity. On subsequent runs, just `homeagent`.
202
204
 
203
- 配置检查使用 `homeagent check-config`,仅显示本机连接、Runner 版本和运行设置。终端在收到 Server 配置后显示实际应用的目录。
205
+ Use `homeagent check-config` to inspect local connection settings, the Runner version and runtime settings only. The terminal shows the actually applied directories after receiving the Server configuration.
204
206
 
205
- 启动或登录时终端会打印 `HomeAgent Runner v<版本> · Node <版本> · <平台>/<架构>`,Server 启动时同样打印自身版本。交互式终端(`homeagent`)使用独立的全屏终端画面,暂时隐藏 Shell 历史,显示应用图标、设备与运行详情、最近活动、连接状态和重连倒计时;窗口缩放时自动调整布局,退出时恢复原终端画面与光标。服务、重定向输出或 `--plain` 仍使用普通日志,`NO_COLOR` 或非真彩色终端降级为单色界面。Dashboard 顶部与页脚显示 Server 版本,“连接与安全 → 版本信息”列出 Server、Runner 协议以及每台设备上报的 Runner 版本,并对与 Server 不一致的 Runner 给出升级提示。`GET /health` 与 `GET /api/state` 也返回版本字段,便于部署脚本核对。`HOMEAGENT_TUI=0`(或 `plain`)关闭交互展示;`HOMEAGENT_TUI=1` 可在 CI 的交互终端中启用,但管道输出和 `TERM=dumb` 始终使用普通日志。
207
+ On startup or login the terminal prints `HomeAgent Runner v<version> · Node <version> · <platform>/<arch>`; the Server prints its own version on startup. The interactive terminal (`homeagent`) uses a separate full-screen view that temporarily hides shell history and shows the app icon, device and runtime details, recent activity, connection status and reconnect countdown; the layout adapts on window resize and the original screen and cursor are restored on exit. Services, redirected output or `--plain` still use ordinary logs, and `NO_COLOR` or non-truecolor terminals fall back to a monochrome UI. The Dashboard header and footer show the Server version, "Connection & Security → Version Info" lists the Server, Runner protocol and each device's reported Runner version, and flags Runners that differ from the Server. `GET /health` and `GET /api/state` also return version fields for deployment scripts. `HOMEAGENT_TUI=0` (or `plain`) disables the interactive view; `HOMEAGENT_TUI=1` can enable it in a CI interactive terminal, but piped output and `TERM=dumb` always use plain logs.
206
208
 
207
- 配对超时或领取响应丢失时可在界面中重新开始,旧配对不会返回长期明文凭据。Esc 取消配对会终止轮询并释放状态目录锁。重新登录或切换服务会先确认,取消时保留原有登录;切换服务使用独立凭据目录。退出登录只删除选定配置的本地凭据,不会自动撤销 Server 上的设备记录,可在 Dashboard 撤销旧设备。非交互式 `login` 仍默认拒绝覆盖已有凭据,显式 `homeagent login --force` 才会替换。
209
+ If pairing times out or the claim response is lost, restart from the UI; an old pairing never returns a long-lived plaintext credential. Esc cancels pairing, terminates polling and releases the state-directory lock. Re-login or switching services asks for confirmation first, and cancelling keeps the existing login; switching services uses a separate credential directory. Logging out deletes only the local credentials of the chosen config and does not automatically revoke the Server's device record; revoke old devices in the Dashboard. The non-interactive `login` still refuses to overwrite existing credentials by default; only an explicit `homeagent login --force` replaces them.
208
210
 
209
- Server 域名变更后,现有凭据不会静默连接另一个 origin,必须显式重新配对。修改本机连接设置后需重启 Runner;网页项目和命令策略会实时下发,不通过 MCP 工具修改。
211
+ After a Server domain change, existing credentials never silently connect to another origin: explicit re-pairing is required. Changing local connection settings requires restarting the Runner; web project and command policies are delivered live and are not modified through MCP tools.
210
212
 
211
- ### 环境变量
213
+ ### Environment variables
212
214
 
213
- `HOMEAGENT_SERVER` 可覆盖连接地址。项目目录不通过环境变量配置;在 Dashboard 保存项目设置后实时下发。
215
+ `HOMEAGENT_SERVER` can override the connection address. Project directories are not configured through environment variables; save project settings in the Dashboard for live delivery.
214
216
 
215
- `HOMEAGENT_MOUSE=0` 可默认关闭全屏界面的鼠标跟踪。支持 SGR 鼠标的终端默认允许点击菜单、底部按钮、登录入口和输入框,滚轮可浏览长菜单与活动;输入框以外按 `m`,或点击鼠标切换按钮,可临时关闭跟踪以选择、复制文本。键盘与鼠标共用当前布局中的控件位置,窗口缩放和菜单滚动后会重新计算点击区域;退出时关闭鼠标跟踪和括号粘贴模式。
217
+ `HOMEAGENT_MOUSE=0` disables mouse tracking in the full-screen UI by default. Terminals with SGR mouse support allow clicking menus, footer buttons, the login entry and input boxes by default, and the wheel can scroll long menus and activity; outside input boxes press `m`, or click the mouse toggle button, to temporarily disable tracking for selecting/copying text. Keyboard and mouse share the current layout's control positions, which are recomputed after resize and menu scrolling; mouse tracking and bracketed paste are turned off on exit.
216
218
 
217
- ### 自启动
219
+ ### Autostart
218
220
 
219
- 完成配对并停止手动运行的 Runner,再安装服务:
221
+ After pairing, stop the manually running Runner and install the service:
220
222
 
221
223
  ```sh
222
224
  homeagent service-install
223
225
  homeagent service-uninstall
224
226
  ```
225
227
 
226
- Linux 创建 `~/.config/systemd/user/homeagent-<配置摘要>.service`,使用 user systemd,无需 root。要在退出登录及开机后持续运行,按安装输出显式执行 `sudo loginctl enable-linger <用户名>`。日志:`journalctl --user -u homeagent-<摘要>.service -f`。
228
+ On Linux this creates `~/.config/systemd/user/homeagent-<config-digest>.service` using user systemd, with no root required. To keep running after logout and at boot, explicitly run `sudo loginctl enable-linger <username>` as printed by the installer. Logs: `journalctl --user -u homeagent-<digest>.service -f`.
227
229
 
228
- Windows 创建当前用户登录触发的计划任务,名称为 `HomeAgent-<配置摘要>`,最低权限运行,无需在系统服务中保存密码。它是“用户登录后启动”,不是“无人登录的系统启动”。若必须无人登录运行,应由管理员为专用低权限账户配置服务管理器;本项目不自动提升权限。查看状态:`Get-ScheduledTask -TaskName 'HomeAgent-*'`。升级或重启前先终止同配置的旧进程,避免两个 Runner 互相替换连接。
230
+ On Windows it creates a logon-triggered scheduled task named `HomeAgent-<config-digest>` running with least privilege, with no password stored in a system service. It starts "after user logon", not "at system boot with no user logged in". If unattended startup is required, an administrator should configure a service manager for a dedicated low-privilege account; this project never elevates privileges automatically. Check status with `Get-ScheduledTask -TaskName 'HomeAgent-*'`. Before upgrading or restarting, stop the old process for the same config so two Runners do not replace each other's connection.
229
231
 
230
- 服务安装会立即启动;不要再同时手动启动同一设备凭据。不要把源码位置移动后保留旧服务路径。
232
+ Service installation starts immediately; do not also start the same device credentials manually. Do not keep an old service path after moving the source location.
231
233
 
232
- v0.2 同一 stateDir 的第二个 Runner 会明确拒绝启动。Windows 卸载先结束计划任务再删除;CLI `--version` 可看版本/Node/平台,`homeagent check-config` 可检查配置而不打印设备令牌。Windows 任务执行依赖系统 PowerShell/.NET Add-Type;组织策略禁止时失败关闭,不自动使用 ExecutionPolicy Bypass。
234
+ Since early versions, a second Runner with the same `stateDir` explicitly refuses to start. On Windows, uninstall ends the scheduled task before deleting it; `CLI --version` shows version/Node/platform, and `homeagent check-config` inspects config without printing the device token. The Windows task relies on system PowerShell/.NET Add-Type; if organizational policy blocks it, the task fails closed and never auto-applies `ExecutionPolicy Bypass`.
233
235
 
234
- Windows 子进程默认显式使用系统 PowerShell 模块目录,避免过滤环境导致模块发现卡住,并排除用户/项目模块加载钩子。源码维护者可执行 `node --import tsx scripts/diagnose-windows.mjs`,使用实际 Runner 环境函数检查监督器启动;需要先安装开发依赖。该检查只输出启动状态与固定测试命令的输出。
236
+ Windows child processes explicitly use the system PowerShell module directory by default, avoiding module-discovery stalls caused by filtered environments and excluding user/project module load hooks. Source maintainers can run `node --import tsx scripts/diagnose-windows.mjs` to check supervisor startup with the real Runner environment functions; development dependencies are required first. That check prints only startup status and the output of a fixed test command. This is the current v0.4.18 behavior for persistent Windows PowerShell shell sessions.
235
237
 
236
- ### 容器 Runner(Linux 可选)
238
+ ### Container Runner (Linux, optional)
237
239
 
238
- 原生 Runner 更适合已有完整开发环境。需要隔离时也可以构建 runner target:
240
+ A native Runner suits an existing full development environment better. For isolation you can also build the runner target:
239
241
 
240
242
  ```sh
241
243
  docker build --target runner -t homeagent-runner:local .
242
244
  ```
243
245
 
244
- 将本机连接设置的 stateDir 设为 `/state`,在 Dashboard 将项目 root 设为 `/workspace`,只把实际项目挂载到 `/workspace`,state 持久卷挂载到 `/state`,配置只读挂载 `/config/runner.json`。容器的 UID/GID 必须对挂载目录有相应权限(镜像默认 node 用户,UID 1000),不要挂载 Docker socket 或整个宿主机根目录。
246
+ Set the local config's `stateDir` to `/state`, set the project root to `/workspace` in the Dashboard, mount only the actual project at `/workspace`, mount a state volume at `/state`, and mount the config read-only at `/config/runner.json`. The container UID/GID must have the right permissions on the mounts (the image defaults to the `node` user, UID 1000); never mount the Docker socket or the entire host root.
245
247
 
246
248
  ```sh
247
249
  docker run --rm -it \
@@ -251,53 +253,64 @@ docker run --rm -it \
251
253
  homeagent-runner:local login --config /config/runner.json
252
254
  ```
253
255
 
254
- 配对后用相同挂载、`--init --restart unless-stopped -d` 运行 `run --config /config/runner.json`。运行阶段不需要 `-it`。镜像只有 Node、Git、CA;其他编译器请自行构建派生镜像。
256
+ After pairing, run `run --config /config/runner.json` with the same mounts and `--init --restart unless-stopped -d`; the run phase does not need `-it`. The image contains only Node, Git and CA certificates; build a derived image for other compilers.
255
257
 
256
- ## 配置表
258
+ ## Configuration Reference
257
259
 
258
- | Server 环境变量 | 默认 / 要求 |
260
+ | Server environment variable | Default / requirement |
259
261
  | --- | --- |
260
- | HOST / PORT | `127.0.0.1` / `3210`;Compose 容器内为 `0.0.0.0:3210` |
261
- | PUBLIC_URL | 固定 origin,不支持子路径,公网必须 HTTPS |
262
- | ADMIN_PASSWORD | 必填,至少 16 字符;生成器使用随机值 |
263
- | SESSION_SECRET | 必填,至少 32 字符;同时保护会话签名与 OAuth 客户端秘密 |
264
- | HOMEAGENT_DB | `./data/server.sqlite`;容器内 `/app/data/server.sqlite` |
265
- | TRUST_PROXY_HOPS | 0;有一层可信反代时设 1 |
266
- | AUDIT_RETENTION_DAYS | 90,范围 1–3650 |
262
+ | HOST / PORT | `127.0.0.1` / `3210`; inside the Compose container `0.0.0.0:3210` |
263
+ | PUBLIC_URL | Fixed origin, no subpath, HTTPS required for public access |
264
+ | ADMIN_PASSWORD | Admin password, at least 16 characters; required when XAuth is not configured, or optional alongside XAuth |
265
+ | XAUTH_ISSUER | Optional [XAuth](https://github.com/jhxxr/XAuth) OIDC issuer origin (e.g. `https://auth.example.com`, no subpath) |
266
+ | XAUTH_CLIENT_ID | Optional XAuth OIDC client ID paired with `XAUTH_ISSUER` |
267
+ | XAUTH_CLIENT_SECRET | Optional client secret for a confidential (`web`) XAuth client |
268
+ | SESSION_SECRET | Required, at least 32 characters; also protects session signing and OAuth client secrets |
269
+ | HOMEAGENT_DB | `./data/server.sqlite`; `/app/data/server.sqlite` in the container |
270
+ | TRUST_PROXY_HOPS | 0; set to 1 with one trusted reverse proxy |
271
+ | AUDIT_RETENTION_DAYS | 90, range 1–3650 |
272
+
273
+ ### XAuth Admin Single Sign-On (Optional)
274
+
275
+ The Web Dashboard supports administrator sign-in via a self-hosted [XAuth](https://github.com/jhxxr/XAuth) OIDC provider:
276
+
277
+ 1. Register a client in XAuth with the redirect URI `<PUBLIC_URL>/login/xauth/callback` (e.g. `https://mcp.example.com/login/xauth/callback`).
278
+ 2. Set `XAUTH_ISSUER` and `XAUTH_CLIENT_ID` (plus `XAUTH_CLIENT_SECRET` for a confidential client) in `.env`. Leave `ADMIN_PASSWORD` empty to enforce XAuth-only login, or keep `ADMIN_PASSWORD` set to allow both methods.
279
+ 3. **Sole-administrator account binding**: The first XAuth account (`sub`) to sign in is permanently bound in SQLite as the sole administrator for the workspace; any subsequent XAuth account with a different `sub` is rejected (`403`).
267
280
 
268
- ## 暂停、撤销与备份
281
+ ## Pause, Revoke, and Backup
269
282
 
270
- Dashboard “暂停”设备关闭连接并停止 Runner 的托管任务,后续调用立即拒绝。恢复后 Runner 自动重连。撤销会使长期设备令牌失效并停止重连;重新使用需要配对。撤销客户端令牌会撤销同族令牌;OAuth 客户端撤销还阻止其继续交换授权。
283
+ The Dashboard "Pause" action closes the connection and stops the Runner's hosted jobs; subsequent calls are rejected immediately. After "Resume" the Runner reconnects automatically. "Revoke" invalidates the long-lived device token and stops reconnection; using the device again requires pairing. Revoking a client token revokes the whole token family; revoking an OAuth client also prevents further authorization exchanges.
271
284
 
272
- 在线备份使用 SQLite backup API,避免直接复制一个正在写入的 WAL 数据库文件:
285
+ Use the SQLite backup API for online backups; do not copy a WAL database file that is being written:
273
286
 
274
287
  ```sh
275
288
  node scripts/backup.mjs ./data/server.sqlite /safe/backups/homeagent.sqlite
276
289
  ```
277
290
 
278
- Docker 中可直接调用相同 API:
291
+ In Docker, call the same API directly:
279
292
 
280
293
  ```sh
281
294
  docker compose exec server node --input-type=module -e "import {DatabaseSync,backup} from 'node:sqlite'; const db=new DatabaseSync('/app/data/server.sqlite'); await backup(db,'/app/data/backup.sqlite'); db.close();"
282
295
  docker compose cp server:/app/data/backup.sqlite ./homeagent-backup.sqlite
283
296
  ```
284
297
 
285
- Server 数据库备份之外,还要单独安全保存 `.env` 的 SESSION_SECRET,以及各 Runner 的 stateDir 和原始配置。不要把备份放在暴露项目根里。备份包含持久凭据的哈希和加密 OAuth 客户端信息,仍应视为敏感数据。
298
+ Beyond the Server database backup, also store `.env`'s `SESSION_SECRET` and each Runner's `stateDir` and original config securely. Do not place backups inside an exposed project root. Backups contain hashes of persistent credentials and encrypted OAuth client data and must still be treated as sensitive.
286
299
 
287
- 恢复前停止 Server,用备份替换数据库;必须同时移除旧的 `server.sqlite-wal` 和 `server.sqlite-shm`(确认服务已停且目标路径正确),再恢复相同所有者和权限。容器方式将备份复制回命名卷的 `/app/data/server.sqlite`,确保 node 用户可读写。不要对旧版本程序直接使用新版本数据库;升级前备份,先在副本验证。
300
+ Before restoring, stop the Server, replace the database with the backup, and remove the old `server.sqlite-wal` and `server.sqlite-shm` as well (only after confirming the service is stopped and the path is correct), then restore the same owner and permissions. For containers, copy the backup back to `/app/data/server.sqlite` in the named volume and ensure the `node` user can read/write it. Do not use a new-version database directly with an old-version program; back up before upgrading and verify on a copy first.
288
301
 
289
- 当前 schema 版本为 `PRAGMA user_version=1`,本版本只创建缺失表,没有声明支持任意跨版本迁移。
302
+ The current schema version is `PRAGMA user_version=1`; this release only creates missing tables and does not claim support for arbitrary cross-version migrations.
290
303
 
291
- ## 故障排查
304
+ ## Troubleshooting
292
305
 
293
- - `/health` 不通:检查监听端口、容器健康状态、Host 转发及 PUBLIC_URL。非默认端口映射时请用 PUBLIC_URL 配置的主机名;例如配置 localhost 时不要直接换成 127.0.0.1 外部映射端口,严格 Host 校验可能返回 403。
294
- - Dashboard API 403:刷新页面取得新 CSRF;确认浏览器访问域名与 PUBLIC_URL 一致。
295
- - MCP 401:确认客户端 Token 未过期/撤销,或重新完成 OAuth;设备令牌不能用作 MCP Token。
296
- - Runner 401:设备被撤销、凭据不匹配或服务器 origin 已变;不要自动把凭据发送到重定向目标。
297
- - Runner 暂停:Server 返回 403,Runner 退避重试;恢复设备后应重新上线。
298
- - Dashboard 任务显示 unconfirmed/missing:表示离线未确认或新快照未报告,不代表成功;不能凭旧 processId 在另一实例上读取/停止。
299
- - v0.1 OAuth 升级:旧 grant 不被静默改写,请撤销并重新授权以启用具体设备/项目范围。升级 Server 后同时升级 Runner,以使用任务快照、幂等键和进程树托管。
300
- - 多设备调用失败:先 `list_devices`,显式填写 deviceId 和 projectId。
301
- - 命令被拒绝:检查项目 commands 是否包含完全相同的可执行文件以及客户端 execute 权限。
302
- - Git 写入被拒绝:检查 git scope、allowGitWrite、独立仓库根、Git identity 和 clean/process filters。
303
- - `node:sqlite` ExperimentalWarning:Node 24 内置 API 的运行时提示,不代表服务启动失败;生产仍应固定并测试 Node 补丁版。
306
+ - `/health` unreachable: check the listening port, container health, Host forwarding and `PUBLIC_URL`. With non-default port mappings use the hostname configured in `PUBLIC_URL`; for example, when configured as `localhost` do not switch to `127.0.0.1` on the mapped external port, since strict Host validation may return 403.
307
+ - Dashboard API 403: refresh the page for a fresh CSRF token; make sure the browser domain matches `PUBLIC_URL`.
308
+ - MCP 401: confirm the client token has not expired or been revoked, or redo OAuth; a device token cannot be used as an MCP token.
309
+ - Runner 401: the device was revoked, credentials do not match, or the Server origin changed; never automatically send credentials to a redirect target.
310
+ - Runner paused: the Server returns 403 and the Runner backs off; it should come back online after the device is resumed.
311
+ - Dashboard job shown as unconfirmed/missing: offline-unconfirmed or not yet reported by a new snapshot; it does not mean success, and an old `processId` cannot be used to read or stop a job on another instance.
312
+ - Legacy v0.1 OAuth upgrade: old grants are not silently rewritten; revoke and re-authorize to enable concrete device/project scopes. After upgrading the Server, upgrade the Runner too for job snapshots, idempotency keys and process-tree supervision.
313
+ - Multi-device call failures: call `list_devices` first and fill in `deviceId` and `projectId` explicitly.
314
+ - Command denied: check that the project `commands` contains the exact executable string and that the client has `execute` scope.
315
+ - Git write denied: check the `git` scope, `allowGitWrite`, an independent repository root, Git identity and clean/process filters.
316
+ - `node:sqlite` ExperimentalWarning: a runtime notice from Node 24's built-in API, not a startup failure; production should still pin and test a Node patch release.