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.
- package/CHANGELOG.md +31 -0
- package/README.md +8 -7
- package/README.zh-CN.md +24 -23
- package/dist/runner/context.js +11 -1
- package/dist/runner/memory.js +169 -0
- package/dist/runner/tools.js +36 -7
- package/dist/shared/protocol.js +1 -1
- package/dist/shared/tools.js +13 -1
- package/docs/ARCHITECTURE.md +46 -44
- package/docs/ARCHITECTURE.zh-CN.md +102 -0
- package/docs/CLIENTS.md +38 -36
- package/docs/CLIENTS.zh-CN.md +132 -0
- package/docs/COMPARISON.md +24 -22
- package/docs/COMPARISON.zh-CN.md +38 -0
- package/docs/DEPLOYMENT.md +119 -106
- package/docs/DEPLOYMENT.zh-CN.md +316 -0
- package/docs/DEVELOPMENT_WORKFLOW.md +41 -39
- package/docs/DEVELOPMENT_WORKFLOW.zh-CN.md +128 -0
- package/docs/OPEN_SOURCE.md +69 -65
- package/docs/OPEN_SOURCE.zh-CN.md +133 -0
- package/docs/README.md +24 -20
- package/docs/README.zh-CN.md +31 -0
- package/docs/REMOTE_ASSIST.md +31 -29
- package/docs/REMOTE_ASSIST.zh-CN.md +48 -0
- package/docs/TOOLS.md +146 -84
- package/docs/TOOLS.zh-CN.md +174 -0
- package/docs/VALIDATION.md +114 -107
- package/docs/VALIDATION.zh-CN.md +179 -0
- package/docs/WEBCODEX_CODE_AUDIT.md +81 -79
- package/docs/WEBCODEX_CODE_AUDIT.zh-CN.md +109 -0
- package/package.json +1 -1
package/docs/COMPARISON.md
CHANGED
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Reference Project Comparison
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**English** · [简体中文](COMPARISON.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Verified 2026-10-26. This comparison is based on public source code, not merely on feature claims.
|
|
6
6
|
|
|
7
|
-
|
|
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
|
-
|
|
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)
|
|
12
|
-
| Better Remote Commander | `cbe511702dd0147650353c29ac6ab1decd8afda1` | [
|
|
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
|
-
|
|
|
18
|
+
| Dimension | WebCodex | Better Remote Commander | HomeAgent's choice |
|
|
17
19
|
| --- | --- | --- | --- |
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
| Runner
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
|
24
|
-
|
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
+
本项目仅借鉴架构与行为设计,代码独立编写。没有将第三方遥测、云中继或托管配对服务引入运行链路。
|
package/docs/DEPLOYMENT.md
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Deployment, Pairing, and Operations
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**English** · [简体中文](DEPLOYMENT.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Preparation
|
|
6
6
|
|
|
7
|
-
|
|
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
|
-
|
|
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
|
-
|
|
11
|
+
## Native Server Deployment
|
|
12
12
|
|
|
13
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
50
|
+
### Linux user systemd service
|
|
49
51
|
|
|
50
|
-
|
|
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
|
-
|
|
60
|
+
Create `$HOME/.config/systemd/user/homeagent-server.service`, replacing the three paths below with your real values:
|
|
59
61
|
|
|
60
|
-
- `WorkingDirectory
|
|
61
|
-
- `ExecStart`
|
|
62
|
-
- `ExecStart`
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
###
|
|
124
|
+
### Automatic TLS with Caddy
|
|
123
125
|
|
|
124
|
-
|
|
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
|
|
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
|
-
###
|
|
140
|
+
### Existing Nginx
|
|
139
141
|
|
|
140
|
-
|
|
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
|
-
###
|
|
144
|
+
### Optional Cloudflare Tunnel
|
|
143
145
|
|
|
144
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
180
|
-
- `commandMode=allowlist
|
|
181
|
-
- `commandMode=unrestricted
|
|
182
|
-
- Git
|
|
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
|
-
|
|
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
|
-
|
|
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`
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
197
|
-
2.
|
|
198
|
-
3.
|
|
199
|
-
4. Runner
|
|
200
|
-
5.
|
|
201
|
-
6.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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`
|
|
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`
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
###
|
|
238
|
+
### Container Runner (Linux, optional)
|
|
237
239
|
|
|
238
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
261
|
-
| PUBLIC_URL |
|
|
262
|
-
| ADMIN_PASSWORD |
|
|
263
|
-
|
|
|
264
|
-
|
|
|
265
|
-
|
|
|
266
|
-
|
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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`
|
|
294
|
-
- Dashboard API 403
|
|
295
|
-
- MCP 401
|
|
296
|
-
- Runner 401
|
|
297
|
-
- Runner
|
|
298
|
-
- Dashboard
|
|
299
|
-
- v0.1 OAuth
|
|
300
|
-
-
|
|
301
|
-
-
|
|
302
|
-
- Git
|
|
303
|
-
- `node:sqlite` ExperimentalWarning
|
|
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.
|