homeagent-runner 0.0.0-stage → 0.4.4
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 +124 -0
- package/CONTRIBUTING.md +65 -0
- package/LICENSE +21 -0
- package/README.en.md +300 -0
- package/README.md +217 -2
- package/SECURITY.md +59 -0
- package/THIRD_PARTY_NOTICES.md +45 -0
- package/bin/runner.mjs +2 -0
- package/dist/runner/agent.js +254 -0
- package/dist/runner/cli.js +66 -0
- package/dist/runner/config-location.js +67 -0
- package/dist/runner/config.js +43 -0
- package/dist/runner/context.js +86 -0
- package/dist/runner/credentials.js +68 -0
- package/dist/runner/editor.js +262 -0
- package/dist/runner/files.js +298 -0
- package/dist/runner/git.js +333 -0
- package/dist/runner/lock.js +28 -0
- package/dist/runner/output-log.js +59 -0
- package/dist/runner/patch.js +103 -0
- package/dist/runner/permissions.js +93 -0
- package/dist/runner/policy.js +87 -0
- package/dist/runner/process-tree.js +28 -0
- package/dist/runner/processes.js +367 -0
- package/dist/runner/service.js +53 -0
- package/dist/runner/setup.js +79 -0
- package/dist/runner/tools.js +118 -0
- package/dist/shared/permissions.js +40 -0
- package/dist/shared/protocol.js +98 -0
- package/dist/shared/tools.js +108 -0
- package/docs/ARCHITECTURE.md +92 -0
- package/docs/CLIENTS.md +130 -0
- package/docs/COMPARISON.md +36 -0
- package/docs/DEPLOYMENT.md +295 -0
- package/docs/DEVELOPMENT_WORKFLOW.md +126 -0
- package/docs/OPEN_SOURCE.md +127 -0
- package/docs/README.md +26 -0
- package/docs/TOOLS.md +105 -0
- package/docs/VALIDATION.md +172 -0
- package/docs/WEBCODEX_CODE_AUDIT.md +107 -0
- package/docs/webcodex-parity-map.json +75 -0
- package/docs/webcodex-source-inventory.json +2254 -0
- package/licenses/npm-runtime.txt +3673 -0
- package/package.json +44 -4
- package/runtime/windows-process-tree.cs +105 -0
- package/runtime/windows-process-tree.ps1 +19 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.4.4 — Runner package publishing and dependency updates
|
|
4
|
+
|
|
5
|
+
- Publish the Runner as `homeagent-runner`, retaining the `homeagent` command.
|
|
6
|
+
The npm package named `homeagent` belongs to another maintainer; install
|
|
7
|
+
`homeagent-runner` to use this project's Runner.
|
|
8
|
+
- Update release validation, package installation checks and installation
|
|
9
|
+
documentation for the available Runner package name.
|
|
10
|
+
- Upgrade Docker images to Node.js 26.12.1 and development dependencies to
|
|
11
|
+
TypeScript 7.0.2 and Node.js 26 type definitions.
|
|
12
|
+
- Update the pinned GitHub Actions used for checkout, Node.js and Python setup,
|
|
13
|
+
and release artifact upload and download.
|
|
14
|
+
|
|
15
|
+
## 0.4.3 — Split Server and Runner npm packages
|
|
16
|
+
|
|
17
|
+
- Publish the Web Dashboard and relay as `homeagent-server`.
|
|
18
|
+
- Publish the outbound Runner as the simplified `homeagent` package and
|
|
19
|
+
command.
|
|
20
|
+
- Update npm packaging, release verification, Docker packaging and deployment
|
|
21
|
+
documentation for the two-package distribution.
|
|
22
|
+
|
|
23
|
+
## 0.4.2 — Server-owned Runner configuration and Web permission UX
|
|
24
|
+
|
|
25
|
+
- Add `homeagent run` and automatic configuration discovery, remembering custom
|
|
26
|
+
locations after successful login or startup.
|
|
27
|
+
- Store project paths for new devices on the Server, with an optional initial
|
|
28
|
+
project in browser approval and no project paths in the generated local config.
|
|
29
|
+
- Allow a Runner to connect with no local projects; keep project access disabled
|
|
30
|
+
until a Web policy applies and report effective directories in the terminal.
|
|
31
|
+
- Remove local project policies, root environment overrides, current-directory
|
|
32
|
+
configuration fallback, the template initializer and manual pairing command.
|
|
33
|
+
- Require Runner protocol 2 with a Server policy on every connection. Disconnects
|
|
34
|
+
and policy failures revoke all project access; no local baseline is restored.
|
|
35
|
+
- Manage command aliases and environment profiles in the Web permission editor,
|
|
36
|
+
and recover interrupted edits only after Server projects are authorized.
|
|
37
|
+
|
|
38
|
+
## 0.4.1 — Interactive Runner login and Dashboard refresh
|
|
39
|
+
|
|
40
|
+
### Runner login and Dashboard
|
|
41
|
+
|
|
42
|
+
- Add interactive Runner login with automatic private configuration creation,
|
|
43
|
+
short-lived browser approval links and a fallback one-time pairing code.
|
|
44
|
+
- Refresh the Dashboard with a responsive monochrome layout, section navigation,
|
|
45
|
+
clearer status cards and more consistent controls.
|
|
46
|
+
|
|
47
|
+
## 0.4.0 — Web-managed device and client permissions
|
|
48
|
+
|
|
49
|
+
### Permissions and control plane
|
|
50
|
+
|
|
51
|
+
- Add Dashboard editors for device capability limits and existing PAT/OAuth
|
|
52
|
+
authorization grants; credentials do not need to be copied again.
|
|
53
|
+
- Add device-wide file access and unrestricted executable modes as separate
|
|
54
|
+
explicit grants. The Runner still protects its configuration and private
|
|
55
|
+
state from built-in file tools.
|
|
56
|
+
- Add temporary device and client permissions with expiry, revision checks,
|
|
57
|
+
automatic task cancellation and restoration of the previous policy.
|
|
58
|
+
- Add per-tool authorization filtering and live `tools/list` updates.
|
|
59
|
+
- Reject stale or incompatible Runner connections when a stored remote device
|
|
60
|
+
policy cannot be safely applied; provide a local-policy recovery path.
|
|
61
|
+
- Persist permission changes, expiry and application failures in the existing
|
|
62
|
+
audit and Dashboard state.
|
|
63
|
+
|
|
64
|
+
### Git and packaging
|
|
65
|
+
|
|
66
|
+
- Add controlled `git_fetch`, fast-forward-only `git_pull` and separately
|
|
67
|
+
enabled `git_push` for configured HTTPS/SSH remotes, including nested
|
|
68
|
+
repositories.
|
|
69
|
+
- Add permission protocol negotiation, Runner acknowledgements and safe
|
|
70
|
+
cancellation of in-flight calls and managed jobs during policy changes.
|
|
71
|
+
- Expand npm packaging and installation checks for the permission Dashboard
|
|
72
|
+
asset.
|
|
73
|
+
|
|
74
|
+
## 0.3.1 — OAuth consent callback fix
|
|
75
|
+
|
|
76
|
+
- Fix browser authorization appearing unresponsive when the form's redirect to
|
|
77
|
+
an external client callback is blocked by `form-action 'self'`.
|
|
78
|
+
- Complete the form navigation on the Server, then return to the registered
|
|
79
|
+
callback through a same-origin completion page with a manual link fallback.
|
|
80
|
+
- Show submission progress and prevent double clicks while preserving the
|
|
81
|
+
submitted allow/deny decision.
|
|
82
|
+
- Make identical consent retries return the same completion receipt for the
|
|
83
|
+
same browser session, without issuing additional authorization codes.
|
|
84
|
+
Callback URLs are encrypted at rest; codes remain short-lived and single-use.
|
|
85
|
+
- Preserve selections on validation errors, display actionable expiration
|
|
86
|
+
messages and recheck client revocation before granting access.
|
|
87
|
+
- Expand Chinese/English deployment instructions for npm, Compose, HTTPS,
|
|
88
|
+
Runner pairing and native Server service management.
|
|
89
|
+
|
|
90
|
+
## 0.3.0 — Initial public release
|
|
91
|
+
|
|
92
|
+
### Remote MCP
|
|
93
|
+
|
|
94
|
+
- Self-hosted relay with authenticated outbound WebSocket runners.
|
|
95
|
+
- Official MCP SDK serving both 2026-07-28 and legacy 2025 HTTP clients.
|
|
96
|
+
- Single-admin Dashboard, device pairing/revocation, OAuth with PKCE and scoped
|
|
97
|
+
personal tokens.
|
|
98
|
+
- Project authorization, local policy, bounded outputs and tool audit records.
|
|
99
|
+
|
|
100
|
+
### Development workflow
|
|
101
|
+
|
|
102
|
+
- 32 MCP tools for project context, file/search/edit, commands, jobs and Git.
|
|
103
|
+
- Line-based batch reads, strict unified diffs and journaled multi-file edits.
|
|
104
|
+
- Local command aliases/environment profiles and short-command responses.
|
|
105
|
+
- Waitable jobs, idempotent starts, bounded prefix and rolling-tail logs.
|
|
106
|
+
- Selected-file commits that preserve unrelated staged entries; explicit linked
|
|
107
|
+
worktree configuration.
|
|
108
|
+
- Project handoff notes and Runner job reconciliation.
|
|
109
|
+
|
|
110
|
+
### Deployment and validation
|
|
111
|
+
|
|
112
|
+
- Docker Compose, Caddy/Nginx examples and optional Cloudflare Tunnel.
|
|
113
|
+
- Linux user service and Windows login-task installers.
|
|
114
|
+
- Linux/Windows integration tests and reproducible Node/Python coding scenarios.
|
|
115
|
+
- Public npm packaging with `homeagent`, `homeagent-runner` and
|
|
116
|
+
`homeagent-server` commands, safe configuration initialization and isolated
|
|
117
|
+
installation checks.
|
|
118
|
+
- Version-tag automation for verified npm tarballs and GitHub Release assets,
|
|
119
|
+
token-based npm authentication and optional OIDC trusted publishing.
|
|
120
|
+
|
|
121
|
+
This is an early self-hosted release. PTY/persistent shells, a detached supervisor,
|
|
122
|
+
automatic worktree registration, preview tunnels and a complete workflow-session
|
|
123
|
+
subsystem are not implemented. See [the workflow limits](docs/DEVELOPMENT_WORKFLOW.md)
|
|
124
|
+
and [validation record](docs/VALIDATION.md).
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for helping improve HomeAgent. Development currently targets a single
|
|
4
|
+
operator, self-hosted relay and Linux/Windows runners.
|
|
5
|
+
|
|
6
|
+
## Local setup
|
|
7
|
+
|
|
8
|
+
Use Node.js 24 LTS (minimum 24.14; the checked version is in `.nvmrc`), npm and Git.
|
|
9
|
+
Python is optional for development, but required to run the Python workflow test.
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm ci
|
|
13
|
+
npm run verify
|
|
14
|
+
npm audit --omit=dev --audit-level=high
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Tests start local servers and child processes in temporary directories. They do
|
|
18
|
+
not require a model API key, external MCP account or cloud VM. If Python is not on
|
|
19
|
+
PATH, set `HOMEAGENT_TEST_PYTHON` to the interpreter executable. The Windows Job
|
|
20
|
+
Object test is skipped on other platforms; Python tests clearly report a skip
|
|
21
|
+
when no interpreter is installed.
|
|
22
|
+
|
|
23
|
+
To run the relay locally:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npm run init
|
|
27
|
+
npm run dev:server
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Create Runner configuration outside every shared project root; see
|
|
31
|
+
[deployment](docs/DEPLOYMENT.md). Do not expose this repository's working directory
|
|
32
|
+
while keeping private Runner configuration inside it.
|
|
33
|
+
|
|
34
|
+
## Scope and changes
|
|
35
|
+
|
|
36
|
+
- Open an issue with a minimal reproduction for bugs. Include platform, Node
|
|
37
|
+
version and sanitized diagnostics.
|
|
38
|
+
- Keep changes focused. Update documentation when configuration or tool behavior
|
|
39
|
+
changes.
|
|
40
|
+
- New tools need input validation, a scope classification, Runner-side policy,
|
|
41
|
+
bounded results and meaningful integration/security coverage.
|
|
42
|
+
- Preserve existing user changes, staged files and credential boundaries. A
|
|
43
|
+
command allowlist is not an operating-system sandbox.
|
|
44
|
+
- Use the existing TypeScript/ES modules style and `npm run verify` before
|
|
45
|
+
submitting a pull request.
|
|
46
|
+
- Regenerate dependency notices after production dependency updates. Preserve
|
|
47
|
+
third-party attribution if incorporating third-party code.
|
|
48
|
+
|
|
49
|
+
Original contributions are submitted under this repository's MIT License. Do not
|
|
50
|
+
submit code or data you do not have permission to share.
|
|
51
|
+
|
|
52
|
+
## Security reports
|
|
53
|
+
|
|
54
|
+
Follow [SECURITY.md](SECURITY.md). Use the hosting repository's private security
|
|
55
|
+
reporting facility when enabled; do not put credentials or an exploitable private
|
|
56
|
+
deployment in a public issue.
|
|
57
|
+
|
|
58
|
+
## Releases
|
|
59
|
+
|
|
60
|
+
[Release preparation](docs/OPEN_SOURCE.md) describes the local checks and clean
|
|
61
|
+
source archive command. Run `npm run release:npm` and `npm run test:package` to
|
|
62
|
+
build the npm tarball and verify an isolated global installation without
|
|
63
|
+
publishing. Never put npm credentials in source files. The version-tag workflow
|
|
64
|
+
publishes the verified tarball using the `NPM_TOKEN` repository secret, or OIDC
|
|
65
|
+
when configured, only after all checks pass.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 HomeAgent contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
# HomeAgent
|
|
2
|
+
|
|
3
|
+
[简体中文](README.md) · English
|
|
4
|
+
|
|
5
|
+
**MIT licensed · v0.4.4 · Linux / Windows · Self-hosted**
|
|
6
|
+
|
|
7
|
+
HomeAgent connects an MCP client to development projects on your own machines.
|
|
8
|
+
The relay authenticates and routes requests; runners connect outbound over
|
|
9
|
+
WebSocket and execute authorized file, command and Git operations locally.
|
|
10
|
+
Runners do not open inbound ports.
|
|
11
|
+
|
|
12
|
+
The execution system does not require a model API key, hosted relay, telemetry or
|
|
13
|
+
paid cloud service. Tool results are still sent to the AI client you choose.
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
AI MCP client
|
|
17
|
+
│ HTTPS /mcp + OAuth or scoped token
|
|
18
|
+
▼
|
|
19
|
+
HomeAgent relay ── Dashboard / SQLite / audit
|
|
20
|
+
▲
|
|
21
|
+
│ authenticated outbound WSS
|
|
22
|
+
│
|
|
23
|
+
Linux or Windows runner
|
|
24
|
+
├─ project policy → file/search/edit tools
|
|
25
|
+
├─ local allowlist → commands and tracked jobs
|
|
26
|
+
└─ Git → inspect, review, commit, fetch, pull and push
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## What works
|
|
30
|
+
|
|
31
|
+
- Official MCP SDK HTTP serving for 2026-07-28 and legacy 2025 clients.
|
|
32
|
+
- One-time pairing, revocable device credentials, scoped personal tokens and
|
|
33
|
+
OAuth authorization-code flow with S256 PKCE.
|
|
34
|
+
- Single-admin Dashboard for devices, projects, jobs, browser sessions, tokens
|
|
35
|
+
and audit records.
|
|
36
|
+
- 35 tools covering project context, line-based batch reads, bounded search,
|
|
37
|
+
strict unified diffs, journaled multi-file edits, commands and Git.
|
|
38
|
+
- Short-command responses, waitable long jobs, idempotent starts, bounded prefix
|
|
39
|
+
and rolling-tail output.
|
|
40
|
+
- Local command aliases/environment profiles, selected-file commits preserving
|
|
41
|
+
unrelated staged entries, and explicit linked-worktree configuration.
|
|
42
|
+
- Docker Compose, Caddy/Nginx examples, optional Cloudflare Tunnel and native
|
|
43
|
+
runner service installers.
|
|
44
|
+
- Dashboard-managed device limits, per-client tool grants and temporary
|
|
45
|
+
elevation with automatic expiry and managed-job cancellation.
|
|
46
|
+
|
|
47
|
+
This is an early self-hosted release, not a claim of feature parity with WebCodex
|
|
48
|
+
or an independently audited operating-system sandbox. Persistent shells/PTY,
|
|
49
|
+
detached tasks surviving runner replacement, automatic worktree registration,
|
|
50
|
+
preview tunnels and a full workflow-session system are not implemented.
|
|
51
|
+
|
|
52
|
+
## Quick start
|
|
53
|
+
|
|
54
|
+
The Server and Runner are separate npm packages. Install them on the relay server
|
|
55
|
+
and the development machines you want to control:
|
|
56
|
+
|
|
57
|
+
| Component | npm package | Command |
|
|
58
|
+
| --- | --- | --- |
|
|
59
|
+
| Server / Web Dashboard | `homeagent-server` | `homeagent-server` |
|
|
60
|
+
| Runner | `homeagent-runner` | `homeagent` |
|
|
61
|
+
|
|
62
|
+
| Environment | Deployment |
|
|
63
|
+
| --- | --- |
|
|
64
|
+
| Linux server for continuous use | Docker Compose, your own domain and Caddy HTTPS |
|
|
65
|
+
| Existing Node.js installation or local evaluation | npm and `homeagent-server` |
|
|
66
|
+
| Existing Nginx / Caddy | Keep the Server on loopback and use your reverse proxy |
|
|
67
|
+
|
|
68
|
+
Follow this order: **start the Server → open the Dashboard → pair a Runner →
|
|
69
|
+
connect your AI client to `/mcp`**. The Server uses built-in SQLite and does not
|
|
70
|
+
need a separate database service.
|
|
71
|
+
|
|
72
|
+
### 1. Deploy the Server
|
|
73
|
+
|
|
74
|
+
**Option A: Docker Compose with Caddy for a public Linux server.**
|
|
75
|
+
|
|
76
|
+
Install Docker Engine, Compose v2 and Git. Point your domain at the server and
|
|
77
|
+
allow inbound TCP ports 80/443. Replace `mcp.example.com` below with your domain.
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
git clone --branch v0.4.4 --depth 1 https://github.com/jhxxr/HomeAgent.git
|
|
81
|
+
cd HomeAgent
|
|
82
|
+
|
|
83
|
+
# Generate random secrets without installing Node.js on the host.
|
|
84
|
+
docker run --rm --user "$(id -u):$(id -g)" \
|
|
85
|
+
-v "$PWD:/work" -w /work \
|
|
86
|
+
node:24.22.1-bookworm-slim node scripts/init.mjs
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Edit the generated `.env`. Keep its random `ADMIN_PASSWORD` and `SESSION_SECRET`;
|
|
90
|
+
change or add:
|
|
91
|
+
|
|
92
|
+
```dotenv
|
|
93
|
+
PUBLIC_URL=https://mcp.example.com
|
|
94
|
+
DOMAIN=mcp.example.com
|
|
95
|
+
TRUST_PROXY_HOPS=1
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
docker compose --profile proxy up -d --build
|
|
100
|
+
docker compose --profile proxy ps
|
|
101
|
+
docker compose logs --tail=100 server
|
|
102
|
+
curl --fail https://mcp.example.com/health
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Caddy obtains the certificate and proxies HTTP/WebSocket connections. Open
|
|
106
|
+
`https://mcp.example.com` and sign in with `ADMIN_PASSWORD` from `.env`. Port
|
|
107
|
+
`3210` is bound only to the host's loopback interface; it does not need public
|
|
108
|
+
access. Images build locally from source.
|
|
109
|
+
|
|
110
|
+
SQLite persists in the `server-data` named volume, and Compose configures
|
|
111
|
+
`restart: unless-stopped`. Back up the database and `.env` before upgrades,
|
|
112
|
+
retain `SESSION_SECRET`, and use ordinary restarts without deleting volumes.
|
|
113
|
+
See [deployment](docs/DEPLOYMENT.md) for backups, restore and an existing Nginx.
|
|
114
|
+
|
|
115
|
+
**Option B: npm on Linux / Windows or an existing Node.js server.**
|
|
116
|
+
|
|
117
|
+
Use Node.js 24 (minimum 24.14.0; `.nvmrc` contains the checked patch version)
|
|
118
|
+
and npm. These commands work in a Linux shell or Windows PowerShell:
|
|
119
|
+
|
|
120
|
+
```sh
|
|
121
|
+
npm install -g homeagent-server@latest
|
|
122
|
+
mkdir homeagent-server
|
|
123
|
+
cd homeagent-server
|
|
124
|
+
homeagent-server init
|
|
125
|
+
homeagent-server
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Open `http://localhost:3210`. The generated `.env` contains `ADMIN_PASSWORD`;
|
|
129
|
+
initialization does not print the password or overwrite an existing file.
|
|
130
|
+
The database defaults to `data/server.sqlite` in this directory.
|
|
131
|
+
|
|
132
|
+
For public access, set `PUBLIC_URL` in `.env` to your fixed HTTPS origin. Set
|
|
133
|
+
`TRUST_PROXY_HOPS=1` for one trusted proxy and proxy Nginx/Caddy to
|
|
134
|
+
`127.0.0.1:3210`. The command runs in the foreground and reads `.env` from its
|
|
135
|
+
**current working directory**. Use a service manager for continuous operation;
|
|
136
|
+
a Linux user systemd example is in [native Server deployment](docs/DEPLOYMENT.md#原生部署-server).
|
|
137
|
+
|
|
138
|
+
### 2. Install and pair a Runner
|
|
139
|
+
|
|
140
|
+
Install Node.js 24 and npm on the development machine. Git operations also need
|
|
141
|
+
a local Git installation. The recommended flow is the interactive login:
|
|
142
|
+
|
|
143
|
+
```sh
|
|
144
|
+
npm install -g homeagent-runner@latest
|
|
145
|
+
homeagent login
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
The terminal asks only for the Web URL and device name, creates the private
|
|
149
|
+
`$HOME/.homeagent/runner.json`, and prints a browser approval link valid for
|
|
150
|
+
10 minutes. In your signed-in browser, confirm the device name, enter its project
|
|
151
|
+
directory and approve it. You can also add projects later in the Dashboard.
|
|
152
|
+
|
|
153
|
+
**The Server stores project directories and permissions.** New local Runner
|
|
154
|
+
configurations contain no `projects/root`. The local `stateDir` holds device
|
|
155
|
+
credentials and job state. Until you configure a project, no project access is
|
|
156
|
+
available. The first project setting is permanent by default; temporary access
|
|
157
|
+
remains available in the permission editor.
|
|
158
|
+
|
|
159
|
+
```sh
|
|
160
|
+
# Start the Runner after login:
|
|
161
|
+
homeagent run
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Successful login or startup remembers the configuration location, so
|
|
165
|
+
`homeagent run` also works from another directory. Use `--config <path>` to select
|
|
166
|
+
another configuration. Lookup order: explicit path, saved location,
|
|
167
|
+
`~/.homeagent/runner.json`.
|
|
168
|
+
For first-time setup and immediate startup, use `homeagent login --run`.
|
|
169
|
+
|
|
170
|
+
Enter Windows project paths such as `E:/Projects/my-app` in the Dashboard.
|
|
171
|
+
Keep configuration and state outside every exposed project. Local settings accept only connection and runtime options; project policies
|
|
172
|
+
come exclusively from the Server.
|
|
173
|
+
|
|
174
|
+
For automatic startup, finish pairing and stop the foreground Runner, then run
|
|
175
|
+
`homeagent service-install`.
|
|
176
|
+
Linux installs a user systemd service; Windows installs a current-user login
|
|
177
|
+
task. The installer discovers the configuration and pins the service to that
|
|
178
|
+
path. This command manages the Runner only.
|
|
179
|
+
|
|
180
|
+
Command execution and Git writes are disabled by default. Enable them in the
|
|
181
|
+
Dashboard's device policy and grant the corresponding client scopes. Command aliases and environment profiles are configured in the Web editor.
|
|
182
|
+
Windows `.cmd` wrappers are not implicitly run through a shell. See the
|
|
183
|
+
[development workflow](docs/DEVELOPMENT_WORKFLOW.md) for executable aliases
|
|
184
|
+
and environment profiles.
|
|
185
|
+
|
|
186
|
+
The Dashboard manages device policies and existing PAT/OAuth grants. Device
|
|
187
|
+
policy controls the upper limit; client grants separately control devices,
|
|
188
|
+
projects, scopes, individual tools, device-wide file access and unrestricted
|
|
189
|
+
execution. Either layer can be temporary. Expiration stops managed jobs and
|
|
190
|
+
restores the permanent Server policy. Disconnecting revokes all project access
|
|
191
|
+
until the Server policy is synchronized again. Upgrade the Server and Runner to the same version.
|
|
192
|
+
|
|
193
|
+
### 3. Connect an AI client
|
|
194
|
+
|
|
195
|
+
| Purpose | Public deployment example |
|
|
196
|
+
| --- | --- |
|
|
197
|
+
| Dashboard | `https://mcp.example.com` |
|
|
198
|
+
| Client MCP endpoint | `https://mcp.example.com/mcp` |
|
|
199
|
+
| Runner `server` configuration | `https://mcp.example.com`, without `/mcp` |
|
|
200
|
+
| Health check | `https://mcp.example.com/health` |
|
|
201
|
+
|
|
202
|
+
Use OAuth and approve the device/project permissions in your browser, or issue
|
|
203
|
+
a client token in the Dashboard with the intended `read / write / execute / git`
|
|
204
|
+
scopes and connect with Bearer authentication. Tokens are shown once; device
|
|
205
|
+
credentials are not client tokens.
|
|
206
|
+
|
|
207
|
+
For a local trial, use `http://localhost:3210`. Remote access requires a fixed
|
|
208
|
+
HTTPS origin, and the Server must be hosted at the origin root rather than a
|
|
209
|
+
URL subpath. See [client setup](docs/CLIENTS.md) for individual clients.
|
|
210
|
+
|
|
211
|
+
### Develop from source
|
|
212
|
+
|
|
213
|
+
Use a source checkout to change the code. npm or Compose handles ordinary
|
|
214
|
+
installation:
|
|
215
|
+
|
|
216
|
+
```sh
|
|
217
|
+
git clone https://github.com/jhxxr/HomeAgent.git
|
|
218
|
+
cd HomeAgent
|
|
219
|
+
npm ci
|
|
220
|
+
npm run build
|
|
221
|
+
npm run init
|
|
222
|
+
npm run server
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
The source Runner commands are
|
|
226
|
+
`npm run runner -- login` and `npm run runner -- run`, with the same
|
|
227
|
+
configuration and approval flow.
|
|
228
|
+
|
|
229
|
+
## Typical development workflow
|
|
230
|
+
|
|
231
|
+
1. `list_devices` and `get_project_context`.
|
|
232
|
+
2. `search_files` and `read_files` for relevant code and full-file hashes.
|
|
233
|
+
3. `edit_files` or `apply_unified_diff` with explicit expected hashes.
|
|
234
|
+
4. `run_command`, then `wait_process` for long executions.
|
|
235
|
+
5. `git_diff`, `git_branches` and `git_commit_paths`.
|
|
236
|
+
6. `save_project_note` for a bounded handoff to the same client identity.
|
|
237
|
+
|
|
238
|
+
For a temporary maintenance task, open the device in the Dashboard, select the
|
|
239
|
+
needed project and capability preset, then edit the existing client
|
|
240
|
+
authorization if it also needs device-wide files or unrestricted execution.
|
|
241
|
+
Revoke the temporary grant early when finished; otherwise its expiry performs
|
|
242
|
+
the same cleanup.
|
|
243
|
+
|
|
244
|
+
Multiple online devices require an explicit `deviceId`. Machine tools also
|
|
245
|
+
require `projectId`. A job UUID is an identifier, not permission to access it.
|
|
246
|
+
|
|
247
|
+
## Documentation
|
|
248
|
+
|
|
249
|
+
Detailed operational documents are currently in Chinese; the examples use the
|
|
250
|
+
same command and configuration names on all platforms.
|
|
251
|
+
|
|
252
|
+
| Document | Purpose |
|
|
253
|
+
| --- | --- |
|
|
254
|
+
| [Documentation index](docs/README.md) | All guides |
|
|
255
|
+
| [Deployment](docs/DEPLOYMENT.md) | Docker, proxies, pairing, services and backups |
|
|
256
|
+
| [Client setup](docs/CLIENTS.md) | ChatGPT, Claude, Cursor and SDK clients |
|
|
257
|
+
| [Development workflow](docs/DEVELOPMENT_WORKFLOW.md) | Tools, profiles, recovery and known limits |
|
|
258
|
+
| [Tool reference](docs/TOOLS.md) | Arguments, scopes and admin endpoints |
|
|
259
|
+
| [Architecture](docs/ARCHITECTURE.md) | Protocol and persistence |
|
|
260
|
+
| [Security](SECURITY.md) | Trust boundaries and reporting |
|
|
261
|
+
| [Validation](docs/VALIDATION.md) | Tests performed and unverified environments |
|
|
262
|
+
| [Source audit](docs/WEBCODEX_CODE_AUDIT.md) | Explicit differences from WebCodex |
|
|
263
|
+
|
|
264
|
+
## Development
|
|
265
|
+
|
|
266
|
+
```sh
|
|
267
|
+
npm ci
|
|
268
|
+
npm run verify
|
|
269
|
+
npm run notices:check
|
|
270
|
+
npm audit --omit=dev --audit-level=high
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Tests use temporary directories and local HTTP/WebSocket servers. Python is
|
|
274
|
+
optional; its workflow test reports a skip if no interpreter is available.
|
|
275
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for environment details.
|
|
276
|
+
|
|
277
|
+
## Security and license
|
|
278
|
+
|
|
279
|
+
An allowed interpreter, shell or build tool runs with the runner account's
|
|
280
|
+
permissions. File-root checks constrain built-in file tools; they do not sandbox
|
|
281
|
+
arbitrary code. Use a dedicated low-privilege account or container/VM.
|
|
282
|
+
|
|
283
|
+
Original source is available under the [MIT License](LICENSE). Dependencies retain
|
|
284
|
+
their own terms in [third-party notices](THIRD_PARTY_NOTICES.md). The release
|
|
285
|
+
produces two public npm packages: `homeagent-server` contains the Server and
|
|
286
|
+
Dashboard, while `homeagent-runner` contains the Runner, shared protocol and Windows
|
|
287
|
+
helpers. Each package has an explicit file list and license notices.
|
|
288
|
+
|
|
289
|
+
See [release preparation](docs/OPEN_SOURCE.md) to generate a reviewed source
|
|
290
|
+
archive. Nothing in the release commands automatically publishes or pushes it.
|
|
291
|
+
|
|
292
|
+
The `v0.4.4` release configuration produces separate `homeagent-server` and
|
|
293
|
+
`homeagent-runner` packages; local release commands do not upload to npm or push a
|
|
294
|
+
GitHub Release. For subsequent releases, increment the version and update the
|
|
295
|
+
version files and changelog before pushing a matching `vX.Y.Z` tag. Configure
|
|
296
|
+
the repository's `NPM_TOKEN` Actions secret for token publishing. Prereleases use
|
|
297
|
+
the npm `next` tag; stable versions use `latest`. Existing npm versions must match
|
|
298
|
+
the verified tarball integrity to resume a failed GitHub Release. See the release
|
|
299
|
+
guide for required token permissions and migration to OIDC trusted publishing
|
|
300
|
+
with the `NPM_AUTH_MODE=oidc` repository variable.
|