homeagent-runner 0.4.16 → 0.4.19
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 +37 -0
- package/README.md +202 -160
- package/README.zh-CN.md +341 -0
- package/dist/runner/lsp.js +999 -0
- package/dist/runner/patch.js +66 -11
- package/dist/runner/shells.js +305 -0
- package/dist/runner/tools.js +19 -2
- package/dist/shared/protocol.js +1 -1
- package/dist/shared/tools.js +24 -4
- 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 +88 -73
- package/docs/TOOLS.zh-CN.md +122 -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 +2 -2
- package/README.en.md +0 -390
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.19 — XAuth OIDC administrator login and sole-administrator binding
|
|
4
|
+
|
|
5
|
+
- Add optional self-hosted [XAuth](https://github.com/jhxxr/XAuth) OIDC administrator
|
|
6
|
+
login (`XAUTH_ISSUER`, `XAUTH_CLIENT_ID`, `XAUTH_CLIENT_SECRET`) with `S256` PKCE,
|
|
7
|
+
server-stored signed state, nonce validation, JWKS caching/rotation and `RS256` ID
|
|
8
|
+
token verification, supporting XAuth-only or dual XAuth + `ADMIN_PASSWORD` sign-in.
|
|
9
|
+
- Automatically bind the first authenticated XAuth account (`sub`) in SQLite as the
|
|
10
|
+
workspace's sole administrator and reject all subsequent XAuth accounts (`403`),
|
|
11
|
+
surfacing the bound administrator identity and session auth method in the Dashboard.
|
|
12
|
+
- Provide aligned English and Simplified Chinese documentation across all 11 guides
|
|
13
|
+
under `docs/` alongside `README.md` and `README.zh-CN.md`.
|
|
14
|
+
|
|
15
|
+
## 0.4.18 — Windows PowerShell persistent shell bootstrap
|
|
16
|
+
|
|
17
|
+
- Initialize persistent Windows PowerShell sessions with an explicit `-NonInteractive -EncodedCommand`
|
|
18
|
+
read-eval loop that pins `PSModulePath` to `$PSHOME\Modules` and imports built-in
|
|
19
|
+
`Microsoft.PowerShell.Management` and `Microsoft.PowerShell.Utility` modules directly
|
|
20
|
+
from `$PSHOME` before reading commands, avoiding Windows CI module auto-discovery stalls
|
|
21
|
+
and `Console.In` stream reader resets.
|
|
22
|
+
- Include the fuzzy unified diff, persistent shell session and lightweight LSP toolset
|
|
23
|
+
with synchronized versions and release metadata.
|
|
24
|
+
|
|
25
|
+
## 0.4.17 — Fuzzy diffs, persistent shell sessions and lightweight LSP
|
|
26
|
+
|
|
27
|
+
- Add bounded fuzzy hunk relocation (`fuzz`) and optional horizontal whitespace
|
|
28
|
+
tolerance (`ignoreWhitespace`) to `apply_unified_diff`, reporting relocated hunk
|
|
29
|
+
offsets while rejecting ambiguous matches and preserving strict `fuzz: 0` mode.
|
|
30
|
+
- Add persistent stateful shell session tools (`start_shell`, `run_shell`,
|
|
31
|
+
`list_shells`, `stop_shell`) supervised by `Processes` (Linux process groups and
|
|
32
|
+
Windows Job Objects), preserving working directory and shell variables across
|
|
33
|
+
commands while enforcing command allowlists and temporary grant expiration.
|
|
34
|
+
- Add lightweight LSP and code intelligence tools (`lsp_document_symbols`,
|
|
35
|
+
`lsp_workspace_symbols`, `lsp_definition`, `lsp_references`, `lsp_hover`,
|
|
36
|
+
`lsp_diagnostics`) with zero-config symbol indexing, cross-file import resolution,
|
|
37
|
+
in-memory syntax/import diagnostics and optional stdio JSON-RPC 2.0 external LSP
|
|
38
|
+
server queries.
|
|
39
|
+
|
|
3
40
|
## 0.4.16 — Consistent project identity and permissions
|
|
4
41
|
|
|
5
42
|
- Give newly added projects random IDs and persist per-device identity history;
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="public/icon.png" width="128" height="128" alt="HomeAgent
|
|
2
|
+
<img src="public/icon.png" width="128" height="128" alt="HomeAgent logo">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<h1 align="center">HomeAgent</h1>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
<strong
|
|
9
|
-
|
|
8
|
+
<strong>Connect AI agents to your own development machines.</strong><br>
|
|
9
|
+
Self-hosted MCP relay · Outbound local execution · Fine-grained permissions
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
12
|
<p align="center">
|
|
@@ -18,113 +18,114 @@
|
|
|
18
18
|
</p>
|
|
19
19
|
|
|
20
20
|
<p align="center">
|
|
21
|
-
|
|
21
|
+
<strong>English</strong> · <a href="README.zh-CN.md">简体中文</a>
|
|
22
22
|
</p>
|
|
23
23
|
|
|
24
24
|
<p align="center">
|
|
25
|
-
<a href="
|
|
26
|
-
<a href="
|
|
27
|
-
<a href="
|
|
28
|
-
<a href="
|
|
29
|
-
<a href="
|
|
25
|
+
<a href="#quick-start">Quick Start</a> ·
|
|
26
|
+
<a href="#ai-prompting-guide">Prompt Guide</a> ·
|
|
27
|
+
<a href="#remote-assist">Remote Assist</a> ·
|
|
28
|
+
<a href="#mcp-tools">MCP Tools</a> ·
|
|
29
|
+
<a href="docs/DEPLOYMENT.md">Deployment</a> ·
|
|
30
|
+
<a href="docs/CLIENTS.md">AI Clients</a> ·
|
|
31
|
+
<a href="docs/README.md">Docs</a> ·
|
|
32
|
+
<a href="CHANGELOG.md">Changelog</a>
|
|
30
33
|
</p>
|
|
31
34
|
|
|
32
35
|
---
|
|
33
36
|
|
|
34
|
-
HomeAgent
|
|
37
|
+
**HomeAgent** is a self-hosted [Model Context Protocol (MCP)](https://modelcontextprotocol.io) relay and local execution runner that lets **Claude**, **ChatGPT**, **Cursor**, and other MCP clients work directly on your Linux and Windows development machines.
|
|
35
38
|
|
|
36
|
-
|
|
39
|
+
Lightweight **Runners** connect outbound over authenticated WebSockets (`WSS`) to your self-hosted **HomeAgent Server**, executing authorized file, terminal, and Git operations locally without opening inbound firewall ports on your workstations. HomeAgent requires no model API keys, third-party cloud relays, or telemetry—tool outputs go straight back to the AI client you choose.
|
|
37
40
|
|
|
38
|
-
##
|
|
41
|
+
## Key Features
|
|
39
42
|
|
|
40
|
-
|
|
43
|
+
| Your Infrastructure, Your Control | Built for Real-World Development |
|
|
44
|
+
| --- | --- |
|
|
45
|
+
| **Self-Hosted Control Plane**: Run the Server, embedded SQLite database, and audit trail on your own VPS or local network. | **45 Built-In MCP Tools**: Project discovery, batch line-range reads, fuzzy unified diffs, journaled multi-file edits, persistent shell sessions, and LSP navigation/diagnostics. |
|
|
46
|
+
| **Outbound-Only Runners**: Connect Linux and Windows machines over authenticated `WSS` without port forwarding or inbound exposure. | **Observable Process Jobs**: Short commands return inline; long tasks support waiting, rolling output tails, standard input, and process-tree termination. |
|
|
47
|
+
| **Two-Layer Permissions**: Combine per-device capability limits with per-client OAuth / token scopes, plus temporary minute-level elevation. | **Safe Git Workflows**: Inspect status and diffs, commit explicit file paths without disturbing unrelated staged changes, and gate `fetch` / `pull` / `push` separately. |
|
|
41
48
|
|
|
42
|
-
##
|
|
49
|
+
## Architecture
|
|
43
50
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
```mermaid
|
|
52
|
+
flowchart TB
|
|
53
|
+
Clients["Claude / ChatGPT / Cursor"] -->|"HTTPS · Streamable MCP · OAuth / Bearer"| Server["HomeAgent Server"]
|
|
54
|
+
Server --- Console["Web Dashboard · SQLite · Audit Log"]
|
|
55
|
+
Runner["Linux / Windows Runner"] -->|"Outbound · WSS"| Server
|
|
56
|
+
Runner --- Files["Project Files & Atomic Edits"]
|
|
57
|
+
Runner --- Commands["Supervised Local Processes"]
|
|
58
|
+
Runner --- Git["Controlled Git Workflows"]
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- **Protocol Compatibility**: Built on the official MCP SDK v2 (`Streamable HTTP` at `/mcp`), supporting both `2026-07-28` discovery/envelopes and `2025` legacy protocol clients.
|
|
62
|
+
- **Authentication**: Supports Web Dashboard sign-in via admin password or [XAuth](https://github.com/jhxxr/XAuth) OIDC (binding the first XAuth account as the sole administrator), plus OAuth 2.1 authorization-code flow with `S256` PKCE, scoped Personal Access Tokens (`Bearer`), and one-time browser or pairing-code device enrollment.
|
|
63
|
+
- **Release Scope**: Current release **v0.4.19** supports a single administrator and multiple devices/projects. Persistent interactive PTY shells, detached jobs surviving runner replacement, automatic worktree registration, and preview tunnels are intentionally out of scope.
|
|
49
64
|
|
|
50
|
-
##
|
|
65
|
+
## Interface Preview
|
|
51
66
|
|
|
52
|
-
|
|
67
|
+
The Web Dashboard maps **AI Clients → MCP Server → Runners** in a live topology view and consolidates active jobs, permission alerts, and audit events.
|
|
53
68
|
|
|
54
|
-

|
|
55
70
|
|
|
56
|
-
|
|
71
|
+
*Screenshots are rendered in a real browser against an isolated local demo environment. The current Web Dashboard UI text is in Simplified Chinese.*
|
|
57
72
|
|
|
58
73
|
<details>
|
|
59
|
-
<summary><strong
|
|
74
|
+
<summary><strong>View mobile topology layout</strong></summary>
|
|
60
75
|
|
|
61
|
-
|
|
76
|
+
On mobile screens, a compact topology keeps clients, the central MCP Server, and Runners on a single screen with live call paths and activity indicators. Tap any node to inspect or edit its settings.
|
|
62
77
|
|
|
63
|
-
<img src="docs/screenshots/dashboard-mobile.png" width="360" alt="HomeAgent
|
|
78
|
+
<img src="docs/screenshots/dashboard-mobile.png" width="360" alt="HomeAgent mobile Dashboard: compact live client-to-MCP-to-Runner topology">
|
|
64
79
|
|
|
65
80
|
</details>
|
|
66
81
|
|
|
67
82
|
<details>
|
|
68
|
-
<summary><strong
|
|
83
|
+
<summary><strong>View device permissions & job output views</strong></summary>
|
|
69
84
|
|
|
70
|
-
|
|
85
|
+
**Device Permissions** · Configure project directories, access presets, command allowlists, Git switches, and temporary grant durations directly in the browser.
|
|
71
86
|
|
|
72
|
-

|
|
73
88
|
|
|
74
|
-
|
|
89
|
+
**Jobs & Output** · Filter running or completed jobs, inspect execution metadata, and read bounded command output.
|
|
75
90
|
|
|
76
|
-

|
|
77
92
|
|
|
78
93
|
</details>
|
|
79
94
|
|
|
80
|
-
##
|
|
81
|
-
|
|
82
|
-
```mermaid
|
|
83
|
-
flowchart TB
|
|
84
|
-
Clients["Claude / ChatGPT / Cursor"] -->|"HTTPS · MCP · OAuth / Token"| Server["HomeAgent Server"]
|
|
85
|
-
Server --- Console["Web Dashboard · SQLite · 审计"]
|
|
86
|
-
Runner["Linux / Windows Runner"] -->|"主动连接 · WSS"| Server
|
|
87
|
-
Runner --- Files["项目文件与代码编辑"]
|
|
88
|
-
Runner --- Commands["本地命令与任务"]
|
|
89
|
-
Runner --- Git["Git 工作流"]
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
使用 MCP 官方 SDK v2,提供 Streamable HTTP `/mcp`,支持 2026-07-28 discovery/envelope 与 2025 协议兼容;认证包括 OAuth 授权码流程、S256 PKCE、限权 Bearer Token 和一次性设备配对。
|
|
95
|
+
## Quick Start
|
|
93
96
|
|
|
94
|
-
|
|
97
|
+
HomeAgent is published as two separate npm packages:
|
|
95
98
|
|
|
96
|
-
|
|
99
|
+
| Component | npm Package | CLI Command | Where to Install |
|
|
100
|
+
| --- | --- | --- | --- |
|
|
101
|
+
| **Server & Web Dashboard** | `homeagent-server` | `homeagent-server` | Your VPS, homelab server, or local machine |
|
|
102
|
+
| **Outbound Runner** | `homeagent-runner` | `homeagent` | Each Linux or Windows development machine |
|
|
97
103
|
|
|
98
|
-
|
|
|
99
|
-
| --- | --- | --- |
|
|
100
|
-
| Server / Web Dashboard | `homeagent-server` | `homeagent-server` |
|
|
101
|
-
| Runner | `homeagent-runner` | `homeagent` |
|
|
102
|
-
|
|
103
|
-
| 场景 | 部署方式 |
|
|
104
|
+
| Deployment Scenario | Recommended Approach |
|
|
104
105
|
| --- | --- |
|
|
105
|
-
| Linux
|
|
106
|
-
|
|
|
107
|
-
|
|
|
106
|
+
| Public Linux server (24/7) | Docker Compose + custom domain + automatic Caddy HTTPS |
|
|
107
|
+
| Local trial or existing Node.js host | Global npm install (`homeagent-server`) |
|
|
108
|
+
| Existing Nginx / Caddy reverse proxy | Bind Server to `127.0.0.1:3210` behind your proxy |
|
|
108
109
|
|
|
109
|
-
|
|
110
|
+
Follow this sequence: **1. Deploy the Server → 2. Pair a Runner → 3. Connect an AI Client**.
|
|
110
111
|
|
|
111
|
-
### 1.
|
|
112
|
+
### 1. Deploy the Server
|
|
112
113
|
|
|
113
|
-
|
|
114
|
+
#### Option A: Docker Compose with Caddy (Recommended for a Linux VPS)
|
|
114
115
|
|
|
115
|
-
|
|
116
|
+
Requires Docker Engine, Docker Compose v2, and Git. Point your domain's DNS record to the server and open inbound TCP ports `80` and `443`. Replace `mcp.example.com` below with your own domain:
|
|
116
117
|
|
|
117
118
|
```sh
|
|
118
|
-
git clone --branch v0.4.
|
|
119
|
+
git clone --branch v0.4.19 --depth 1 https://github.com/jhxxr/HomeAgent.git
|
|
119
120
|
cd HomeAgent
|
|
120
121
|
|
|
121
|
-
#
|
|
122
|
+
# Generate random ADMIN_PASSWORD and SESSION_SECRET in .env without installing Node.js on the host
|
|
122
123
|
docker run --rm --user "$(id -u):$(id -g)" \
|
|
123
124
|
-v "$PWD:/work" -w /work \
|
|
124
125
|
node:24.22.1-bookworm-slim node scripts/init.mjs
|
|
125
126
|
```
|
|
126
127
|
|
|
127
|
-
|
|
128
|
+
Edit `.env`—keep the generated `ADMIN_PASSWORD` and `SESSION_SECRET`, and set your public domain:
|
|
128
129
|
|
|
129
130
|
```dotenv
|
|
130
131
|
PUBLIC_URL=https://mcp.example.com
|
|
@@ -132,155 +133,201 @@ DOMAIN=mcp.example.com
|
|
|
132
133
|
TRUST_PROXY_HOPS=1
|
|
133
134
|
```
|
|
134
135
|
|
|
136
|
+
Build and start the stack:
|
|
137
|
+
|
|
135
138
|
```sh
|
|
136
139
|
docker compose --profile proxy up -d --build
|
|
137
140
|
docker compose --profile proxy ps
|
|
138
|
-
docker compose logs --tail=100 server
|
|
139
141
|
curl --fail https://mcp.example.com/health
|
|
140
142
|
```
|
|
141
143
|
|
|
142
|
-
Caddy
|
|
144
|
+
Caddy automatically provisions TLS certificates and proxies HTTP and WebSocket traffic. Open `https://mcp.example.com` and sign in with `ADMIN_PASSWORD` from `.env`. Port `3210` binds only to `127.0.0.1` on the host, and SQLite data persists in the `server-data` Docker volume. See the [Deployment Guide](docs/DEPLOYMENT.md) for backups, upgrades, and custom Nginx setups.
|
|
143
145
|
|
|
144
|
-
|
|
146
|
+
#### Option B: Native via npm (Linux, Windows, or Local Trial)
|
|
145
147
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
需要 Node.js 24(最低 24.14.0,仓库固定的验证补丁版见 `.nvmrc`)和 npm。以下命令可在 Linux shell 或 Windows PowerShell 中执行:
|
|
148
|
+
Requires **Node.js >= 24.14.0** (see `.nvmrc` for the pinned verification version) and npm. Run in a Linux shell or Windows PowerShell:
|
|
149
149
|
|
|
150
150
|
```sh
|
|
151
151
|
npm install -g homeagent-server@latest
|
|
152
|
-
mkdir homeagent-server
|
|
153
|
-
cd homeagent-server
|
|
152
|
+
mkdir homeagent-server && cd homeagent-server
|
|
154
153
|
homeagent-server init
|
|
155
154
|
homeagent-server
|
|
156
155
|
```
|
|
157
156
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
公网部署时,先将 `.env` 的 `PUBLIC_URL` 改成固定 HTTPS 域名;一层可信反向代理时设 `TRUST_PROXY_HOPS=1`,再由 Nginx/Caddy 代理到 `127.0.0.1:3210`。`homeagent-server` 在前台运行,并从**当前工作目录**读取 `.env`;长期运行需配置服务管理器。Linux systemd 示例见 [原生 Server 部署](docs/DEPLOYMENT.md#原生部署-server)。
|
|
157
|
+
- **Local Access**: Open `http://localhost:3210` and sign in using the `ADMIN_PASSWORD` written to `.env` in the current working directory. SQLite data is stored at `data/server.sqlite`.
|
|
158
|
+
- **Public Access**: Set `PUBLIC_URL=https://mcp.example.com` and `TRUST_PROXY_HOPS=1` in `.env`, then reverse-proxy traffic to `127.0.0.1:3210`. Use `systemd` or a process manager for background execution (see [Native Server Deployment](docs/DEPLOYMENT.md#native-server-deployment)).
|
|
161
159
|
|
|
162
|
-
### 2.
|
|
160
|
+
### 2. Install & Pair a Runner
|
|
163
161
|
|
|
164
|
-
|
|
162
|
+
On the development machine you want to connect, install **Node.js >= 24.14.0**, npm, and `git`:
|
|
165
163
|
|
|
166
164
|
```sh
|
|
167
165
|
npm install -g homeagent-runner@latest
|
|
168
166
|
homeagent
|
|
169
167
|
```
|
|
170
168
|
|
|
171
|
-
|
|
169
|
+
1. **Interactive Login**: On first launch, the full-screen terminal interface prompts for your Server URL and a device name, creating `~/.homeagent/runner.json`.
|
|
170
|
+
2. **Browser Approval**: Press `o` to open the 10-minute approval link in your signed-in browser. Verify the device name, enter an initial project directory (e.g., `/home/me/app` or `E:/Projects/my-app`) and optional project name, and approve.
|
|
171
|
+
3. **Automatic Connection**: Once approved, the Runner connects immediately and remembers its configuration path so you can run `homeagent` from any directory.
|
|
172
172
|
|
|
173
|
-
|
|
173
|
+

|
|
174
174
|
|
|
175
|
-
|
|
175
|
+
*Terminal output from an isolated demo environment. Interactive shells open the responsive full-screen Runner TUI; services, piped output, and `homeagent run --plain` emit standard line-based logs.*
|
|
176
176
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
```
|
|
177
|
+
- **TUI Shortcuts & Mouse Support**: Press `s` for Settings (device name, concurrency limits, config file, Server switching, autostart, logout), `a` for Activity, `o` to open the Dashboard, `p` to pause/resume, `m` to toggle SGR mouse tracking (or set `HOMEAGENT_MOUSE=0`), and `q` or `Ctrl+C` to exit cleanly.
|
|
178
|
+
- **Autostart Service**: Open Settings (`s`) and select **Enable autostart** (or run `homeagent service-install` while stopped) to install a Linux user `systemd` service or a Windows login scheduled task.
|
|
179
|
+
- **Server-Owned Policies**: Project directories, command allowlists, environment profiles, and Git write flags are managed centrally on the Server—never hardcoded in local `runner.json`. Command execution and Git writes are disabled by default until enabled in the Dashboard.
|
|
181
180
|
|
|
182
|
-
|
|
181
|
+
### 3. Connect an AI Client
|
|
183
182
|
|
|
184
|
-
|
|
183
|
+
| Endpoint | Public Deployment Example | Notes |
|
|
184
|
+
| --- | --- | --- |
|
|
185
|
+
| **Web Dashboard** | `https://mcp.example.com` | Admin sign-in, device/client permissions, jobs, and audit logs |
|
|
186
|
+
| **MCP Client URL** | `https://mcp.example.com/mcp` | Streamable HTTP endpoint for Claude, ChatGPT, Cursor, etc. |
|
|
187
|
+
| **Runner `server` URL** | `https://mcp.example.com` | Base origin without `/mcp` |
|
|
188
|
+
| **Health Check** | `https://mcp.example.com/health` | Returns `version` and `runnerProtocol` |
|
|
185
189
|
|
|
186
|
-
|
|
190
|
+
- **OAuth 2.1**: Point your MCP client to `https://mcp.example.com/mcp` and approve the requested device, project, and scope permissions in your browser.
|
|
191
|
+
- **Personal Access Token (`Bearer`)**: Issue a scoped token (`read`, `write`, `execute`, `git`) in the Dashboard and configure your client with `Authorization: Bearer <token>`.
|
|
192
|
+
- **Version Alignment**: Keep `homeagent-server` and `homeagent-runner` on the same release (`v0.4.19`). Check versions anytime with `homeagent-server --version`, `homeagent --version`, or in the Dashboard header.
|
|
193
|
+
- **Client Guides**: See [Connecting AI Clients](docs/CLIENTS.md) for step-by-step instructions across Claude, ChatGPT, Cursor, and the MCP SDK.
|
|
187
194
|
|
|
188
|
-
|
|
195
|
+
## AI Prompting Guide
|
|
189
196
|
|
|
190
|
-
|
|
197
|
+
Once your AI client (ChatGPT, Claude, Cursor, etc.) is connected to `/mcp`, follow this workflow to drive remote development safely and efficiently.
|
|
191
198
|
|
|
192
|
-
|
|
199
|
+
### How to Instruct the AI
|
|
193
200
|
|
|
194
|
-
|
|
201
|
+
1. **Check Permissions First**: Before prompting, verify in the Dashboard that both the **Device Project Policy** and the **Client Grant** allow the required scopes (`read` for inspection, `write` for editing files, `execute` plus command aliases/allowlists for running tests, and `git` for commits).
|
|
202
|
+
2. **Start with Discovery**: Always ask the AI to call `list_devices` and `get_project_context` first. This tells the AI your exact `deviceId`, `projectId`, active Git branch/HEAD, configured command aliases (such as `test`, `npm`, `python`), and any handoff notes from previous sessions.
|
|
203
|
+
3. **Require Hash-Verified Edits & Safe Commits**: HomeAgent tools use full-file SHA-256 preconditions (`expectedSha256`) and explicit path commits (`git_commit_paths`) so the AI never blindly overwrites concurrent local edits or sweeps unrelated staged files into a commit.
|
|
195
204
|
|
|
196
|
-
|
|
205
|
+
### Ready-to-Use Prompt Templates
|
|
197
206
|
|
|
198
|
-
|
|
207
|
+
Copy and paste any of the templates below into your AI client, replacing the bracketed placeholders (like `[my-workstation]` or `[my-app]`) with your actual device, project, and task.
|
|
199
208
|
|
|
200
|
-
|
|
209
|
+
#### 1. Feature Development / Bug Fix (Full Workflow)
|
|
201
210
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
211
|
+
```text
|
|
212
|
+
Use the HomeAgent MCP tools to work on my remote project:
|
|
213
|
+
- Target device: [my-workstation] (call list_devices first to find the exact deviceId and projectId for [my-app])
|
|
214
|
+
- Task: [Describe the feature to build or bug to fix, e.g., "Fix the pagination off-by-one error in the user list API and add unit tests"]
|
|
215
|
+
|
|
216
|
+
Please follow this exact workflow:
|
|
217
|
+
1. Call list_devices and get_project_context to inspect the repository state, current Git branch/HEAD, available commandAliases, and any previous handoff notes.
|
|
218
|
+
2. Use search_files and read_files (with line ranges) to locate and read the relevant code. Keep the returned full-file sha256 hashes.
|
|
219
|
+
3. Propose your changes and apply them using edit_files or apply_unified_diff with the exact expectedSha256 values.
|
|
220
|
+
4. Run the test suite via run_command using the configured command alias or executable. If the job stays running, poll with wait_process (and tail_process_output if needed) rather than starting duplicate processes.
|
|
221
|
+
5. Show me the git_diff summary and test results. Wait for my confirmation before calling git_commit_paths, and finish by saving a brief progress summary with save_project_note.
|
|
222
|
+
```
|
|
208
223
|
|
|
209
|
-
|
|
224
|
+
#### 2. Read-Only Code Review & Troubleshooting
|
|
210
225
|
|
|
211
|
-
|
|
226
|
+
```text
|
|
227
|
+
Connect via HomeAgent MCP to project [my-app] on device [my-workstation] in read-only mode:
|
|
228
|
+
1. Call list_devices and get_project_context to check the project structure, recent git_log, and git_status.
|
|
229
|
+
2. Use search_files and read_files to trace how [specific module / endpoint / error] is implemented.
|
|
230
|
+
3. Do not modify any files or run any commands—summarize the root cause, point out the exact file paths and line numbers, and propose a concrete fix plan for my review.
|
|
231
|
+
```
|
|
212
232
|
|
|
213
|
-
|
|
233
|
+
#### 3. Resume Work from a Previous Session (Handoff Continuity)
|
|
214
234
|
|
|
215
|
-
|
|
235
|
+
```text
|
|
236
|
+
Connect to project [my-app] on device [my-workstation] via HomeAgent MCP:
|
|
237
|
+
1. Call list_devices and get_project_context, and read the saved project handoff note, current git_status, git_diff, and list_processes.
|
|
238
|
+
2. Summarize what was completed in the previous session, whether any background job is still running or finished, and what remains to be done.
|
|
239
|
+
3. Continue with the next step: [describe the next task or say "proceed with the remaining items in the project note"].
|
|
240
|
+
```
|
|
216
241
|
|
|
217
|
-
|
|
242
|
+
#### 4. Autonomous Fix-Test-Commit Loop
|
|
218
243
|
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
npm run server
|
|
244
|
+
```text
|
|
245
|
+
On device [my-workstation], project [my-app], run the test suite via HomeAgent's run_command tool and fix any failing tests:
|
|
246
|
+
1. Call get_project_context to see the configured test command alias and current Git HEAD.
|
|
247
|
+
2. Run the tests with run_command (use wait_process if needed) and inspect failures with read_files.
|
|
248
|
+
3. Patch the code with edit_files using expectedSha256 and re-run the tests until they pass.
|
|
249
|
+
4. Once all tests pass, verify changes with git_diff, commit only the files you modified using git_commit_paths (preserving any unrelated staged files), and record a summary with save_project_note.
|
|
226
250
|
```
|
|
227
251
|
|
|
228
|
-
|
|
252
|
+
## Remote Assist
|
|
229
253
|
|
|
230
|
-
|
|
254
|
+
Need a collaborator or teammate's AI agent to help debug a machine without giving them admin credentials or permanent access?
|
|
231
255
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
所有机器工具使用 `projectId`。多台有权限的设备同时在线时必须指定 `deviceId`,防止误操作另一台机器。进程使用任务 UUID,由启动它的客户端主体和项目共同拥有,不接受任意系统 PID。
|
|
256
|
+
1. **Create an Invitation**: In the Dashboard (**Devices & Projects → Invite a Friend**), generate a 10-minute one-time invitation bound to an existing client authorization.
|
|
257
|
+
2. **Run Locally**: The device owner runs the copied command on their machine:
|
|
258
|
+
```sh
|
|
259
|
+
homeagent assist "https://mcp.example.com/assist#id=...&token=..."
|
|
260
|
+
```
|
|
261
|
+
3. **Explicit Local Consent**: In their local terminal, the device owner selects **1–16 project directories**, per-project read/write/executable allowlists, and a shared time limit (30m / 2h / 8h).
|
|
262
|
+
4. **Instant Revocation**: Access starts only after local approval and terminates immediately on local stop, exit, expiration, or disconnect. See the [Remote Assist Guide](docs/REMOTE_ASSIST.md).
|
|
240
263
|
|
|
241
|
-
|
|
264
|
+
## MCP Tools
|
|
242
265
|
|
|
243
|
-
|
|
266
|
+
### 45 Built-In Tools
|
|
244
267
|
|
|
245
|
-
|
|
268
|
+
| Category | Tools |
|
|
269
|
+
| --- | --- |
|
|
270
|
+
| **Discovery & Handoff** | `list_devices`, `get_project_context`, `save_project_note` |
|
|
271
|
+
| **Files & Code Editing** | `list_directory`, `read_file`, `read_files`, `write_file`, `create_directory`, `move_file`, `get_file_info`, `search_files`, `edit_block`, `edit_files`, `apply_unified_diff`, `get_edit_transactions`, `recover_edit_transaction` |
|
|
272
|
+
| **LSP & Code Intelligence** | `lsp_document_symbols`, `lsp_workspace_symbols`, `lsp_definition`, `lsp_references`, `lsp_hover`, `lsp_diagnostics` |
|
|
273
|
+
| **Processes & Persistent Shells** | `start_process`, `run_command`, `wait_process`, `read_process_output`, `tail_process_output`, `write_process_input`, `list_processes`, `stop_process`, `start_shell`, `run_shell`, `list_shells`, `stop_shell` |
|
|
274
|
+
| **Git Workflow** | `git_status`, `git_diff`, `git_log`, `git_add`, `git_commit`, `git_commit_paths`, `git_branches`, `git_switch_branch`, `git_fetch`, `git_pull`, `git_push` |
|
|
246
275
|
|
|
247
|
-
|
|
276
|
+
Every machine tool targets an explicit `projectId` (and requires `deviceId` whenever multiple authorized devices are online). Processes are tracked by job UUIDs owned by the initiating client principal and project—never arbitrary OS PIDs—and supervised via Linux process groups or Windows Job Objects. See [Development Workflow](docs/DEVELOPMENT_WORKFLOW.md) and [Tool Reference](docs/TOOLS.md).
|
|
248
277
|
|
|
249
|
-
-
|
|
250
|
-
- **客户端权限**:修改已有 PAT 或 OAuth 授权的设备、项目、scope、具体工具,以及“目录外文件”和“任意程序”高级开关,不需要重新复制凭据。
|
|
251
|
-
- **临时开放**:设备和客户端权限都可设置分钟级有效期;到期会停止相关托管任务并恢复原权限。权限 revision 冲突会被拒绝,避免覆盖他人的更新。
|
|
278
|
+
### Two-Layer Web Permissions
|
|
252
279
|
|
|
253
|
-
|
|
280
|
+
Effective access is always the intersection of **Device Capability Limits ∩ Client Authorization**:
|
|
254
281
|
|
|
255
|
-
|
|
282
|
+
- **Device Policy**: Per-project root paths (or explicit device-wide file access), command allowlists (or explicit unrestricted program execution), local Git writes, `fetch`/`pull` network access, and separate `push` authorization.
|
|
283
|
+
- **Client Grants**: Live adjustment of authorized devices, projects, scopes (`read` / `write` / `execute` / `git`), individual tools, and advanced toggles for existing OAuth or PAT credentials—without rotating tokens.
|
|
284
|
+
- **Temporary Elevation**: Grant minute-level temporary permissions on either layer; expiration automatically cancels in-flight calls, stops managed jobs, and restores the baseline policy.
|
|
256
285
|
|
|
257
|
-
|
|
258
|
-
- [参考项目对比](docs/COMPARISON.md):源码修订、架构、协议、工具、安全与取舍。
|
|
259
|
-
- [WebCodex 逐工具源码审计](docs/WEBCODEX_CODE_AUDIT.md):29 个工具域、192 条声明的逐项映射,已修正缺口和仍未实现的能力;不宣称全量功能对等。
|
|
260
|
-
- [架构与技术选型](docs/ARCHITECTURE.md):模块、信任边界、消息协议、持久化及并发。
|
|
261
|
-
- [部署与运维](docs/DEPLOYMENT.md):Docker、Caddy、Nginx、可选 Cloudflare Tunnel、配对、自启动、备份恢复。
|
|
262
|
-
- [AI 客户端连接](docs/CLIENTS.md):ChatGPT、Claude、Cursor 及 MCP SDK 调试。
|
|
263
|
-
- [工具与配置参考](docs/TOOLS.md):调用格式、范围、分页、进程行为和权限。
|
|
264
|
-
- [安全模型](SECURITY.md):命令执行的真实权限、默认限制与尚未提供的隔离能力。
|
|
265
|
-
- [验证记录](docs/VALIDATION.md):已经执行的验证和未执行的环境验收。
|
|
266
|
-
- [日常开发工作流](docs/DEVELOPMENT_WORKFLOW.md):从失败测试到安全提交、断线接续;同时列明仍未实现的交互终端与预览能力。
|
|
286
|
+
## Project Structure & Documentation
|
|
267
287
|
|
|
268
288
|
```text
|
|
269
|
-
bin/ #
|
|
289
|
+
bin/ # CLI entry points for homeagent-server and homeagent
|
|
270
290
|
src/
|
|
271
|
-
shared/ #
|
|
272
|
-
server/ # MCP,
|
|
273
|
-
runner/ #
|
|
274
|
-
public/ # Dashboard
|
|
275
|
-
deploy/ # Caddy and Nginx
|
|
276
|
-
scripts/ #
|
|
277
|
-
tests/ #
|
|
278
|
-
runtime/ # Windows process-tree supervisor sources
|
|
279
|
-
licenses/ #
|
|
280
|
-
.github/ # Linux/Windows/Docker checks and npm/GitHub Release publishing
|
|
291
|
+
shared/ # Versioned wire schemas, tool contracts, and permission scopes
|
|
292
|
+
server/ # MCP HTTP transport, WebSocket hub, OAuth, pairing, SQLite, admin API
|
|
293
|
+
runner/ # Outbound agent, local policy enforcement, file/process/Git executors, TUI
|
|
294
|
+
public/ # Self-contained Web Dashboard assets (zero CDN or external font dependencies)
|
|
295
|
+
deploy/ # Caddy and Nginx reverse-proxy templates
|
|
296
|
+
scripts/ # Secret initialization, SQLite online backup, and release verification
|
|
297
|
+
tests/ # Security, tool, TUI, and end-to-end MCP/WebSocket/OAuth test suites
|
|
298
|
+
runtime/ # Windows Job Object process-tree supervisor sources
|
|
299
|
+
licenses/ # Locked runtime dependency license notices
|
|
281
300
|
```
|
|
282
301
|
|
|
283
|
-
|
|
302
|
+
*Note: Detailed operational guides in `docs/` are available in both English (canonical, unsuffixed files) and Simplified Chinese (`.zh-CN.md` files), using identical CLI commands and configuration keys across platforms.*
|
|
303
|
+
|
|
304
|
+
| Guide | Description |
|
|
305
|
+
| --- | --- |
|
|
306
|
+
| [Documentation Index](docs/README.md) | Complete documentation overview |
|
|
307
|
+
| [Deployment & Operations](docs/DEPLOYMENT.md) | Docker Compose, Caddy, Nginx, Cloudflare Tunnel, pairing, autostart, and backups |
|
|
308
|
+
| [Connecting AI Clients](docs/CLIENTS.md) | Claude, ChatGPT, Cursor, and MCP SDK setup |
|
|
309
|
+
| [Development Workflow](docs/DEVELOPMENT_WORKFLOW.md) | Command profiles, batch file edits, recovery journals, and workflow boundaries |
|
|
310
|
+
| [Remote Assist Guide](docs/REMOTE_ASSIST.md) | One-time invitations, multi-project local consent, and security considerations |
|
|
311
|
+
| [Tools & Admin Reference](docs/TOOLS.md) | Tool schemas, scopes, pagination limits, and admin endpoints |
|
|
312
|
+
| [Architecture](docs/ARCHITECTURE.md) | Module boundaries, wire protocol, persistence, and concurrency model |
|
|
313
|
+
| [Security Policy](SECURITY.md) | Trust boundaries, execution model, and vulnerability reporting |
|
|
314
|
+
| [Validation Record](docs/VALIDATION.md) | Automated verification coverage and environment scope |
|
|
315
|
+
| [Project Comparison](docs/COMPARISON.md) & [Source Audit](docs/WEBCODEX_CODE_AUDIT.md) | Architectural comparison and tool-by-tool audit against reference systems |
|
|
316
|
+
|
|
317
|
+
## Development & Verification
|
|
318
|
+
|
|
319
|
+
To build and run from source:
|
|
320
|
+
|
|
321
|
+
```sh
|
|
322
|
+
git clone https://github.com/jhxxr/HomeAgent.git
|
|
323
|
+
cd HomeAgent
|
|
324
|
+
npm ci
|
|
325
|
+
npm run build
|
|
326
|
+
npm run init
|
|
327
|
+
npm run server
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
Run the full verification suite before submitting changes:
|
|
284
331
|
|
|
285
332
|
```sh
|
|
286
333
|
npm run verify
|
|
@@ -288,14 +335,9 @@ npm run notices:check
|
|
|
288
335
|
npm audit --omit=dev --audit-level=high
|
|
289
336
|
```
|
|
290
337
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
## 贡献与许可证
|
|
294
|
-
|
|
295
|
-
欢迎提交可复现的问题和聚焦的改动,开发方式见 [CONTRIBUTING.md](CONTRIBUTING.md),版本范围见 [CHANGELOG.md](CHANGELOG.md)。安全问题按 [SECURITY.md](SECURITY.md) 私下报告。
|
|
296
|
-
|
|
297
|
-
原始源码使用 [MIT License](LICENSE)。依赖保留自己的许可,见 [第三方声明](THIRD_PARTY_NOTICES.md)。本项目独立开发,不代表 WebCodex、Desktop Commander 或任何 AI 客户端厂商。
|
|
338
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development guidelines and [docs/OPEN_SOURCE.md](docs/OPEN_SOURCE.md) for source archive and dual-package npm release checks.
|
|
298
339
|
|
|
299
|
-
|
|
340
|
+
## Security & License
|
|
300
341
|
|
|
301
|
-
|
|
342
|
+
- **Execution Boundary**: Directory policies strictly confine built-in file tools, and Runner state/credentials are always excluded. However, **command allowlists are not an OS sandbox**—once you authorize an interpreter, shell, or build tool, it runs with the OS privileges of the Runner user account. Use a dedicated low-privilege user account, container, or VM when isolating untrusted workloads. See [SECURITY.md](SECURITY.md).
|
|
343
|
+
- **License**: Released under the [MIT License](LICENSE). Third-party runtime dependencies retain their respective licenses in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md). HomeAgent is an independent open-source project and is not affiliated with WebCodex, Desktop Commander, or any AI client vendor.
|