homeagent-runner 0.4.7 → 0.4.9
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 +38 -0
- package/README.en.md +18 -6
- package/README.md +10 -6
- package/dist/runner/agent.js +10 -2
- package/dist/runner/cli.js +32 -12
- package/dist/runner/tui.js +308 -0
- package/dist/shared/protocol.js +1 -1
- package/dist/shared/version.js +4 -0
- package/docs/CLIENTS.md +1 -1
- package/docs/DEPLOYMENT.md +4 -2
- package/docs/OPEN_SOURCE.md +8 -8
- package/docs/TOOLS.md +2 -2
- package/docs/screenshots/dashboard-mobile.png +0 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.9 — Version visibility and adaptive Runner TUI
|
|
4
|
+
|
|
5
|
+
- Refine the Runner startup card into a compact side-by-side icon and details
|
|
6
|
+
layout on wide terminals, with stacked and borderless layouts for narrow
|
|
7
|
+
terminals. Respect custom widths and Unicode grapheme widths; bound the live
|
|
8
|
+
status line to avoid wrapping and strip terminal controls from displayed data.
|
|
9
|
+
- Update reconnect countdowns and restore the cursor when the Agent stops itself;
|
|
10
|
+
keep redirected output plain even when `HOMEAGENT_TUI=1` is set.
|
|
11
|
+
- Compare prerelease version identifiers in semantic order and accept build
|
|
12
|
+
metadata when reporting Server/Runner version differences.
|
|
13
|
+
|
|
14
|
+
- Add an interactive startup card for `homeagent run`: the app icon rendered in
|
|
15
|
+
truecolor half blocks, version, device, Server, configuration location and
|
|
16
|
+
runtime details, plus a live status line for connecting, connected, reconnect
|
|
17
|
+
and stopped states. Piped output, services and `--plain` keep the single-line
|
|
18
|
+
version log, and `NO_COLOR`/`HOMEAGENT_TUI` control the presentation.
|
|
19
|
+
- Print the exact Server and Runner version, Node version and platform when a
|
|
20
|
+
CLI starts; `homeagent check-config` now reports the same runtime details.
|
|
21
|
+
- Show the Server version in the Dashboard header, footer, login page and a new
|
|
22
|
+
Settings → 版本信息 table that lists every paired Runner with its reported
|
|
23
|
+
version, runtime and a match/upgrade hint.
|
|
24
|
+
- Flag Runner versions that differ from the Server in the device cards and the
|
|
25
|
+
overview permission reminders, and expose `version`, `runnerProtocol` and
|
|
26
|
+
runtime details from `/api/state` and `/health`.
|
|
27
|
+
- Add version consistency tests across `package.json`, the lockfile, the runtime
|
|
28
|
+
constant, the CLIs and the Dashboard.
|
|
29
|
+
|
|
30
|
+
## 0.4.8 — Compact live topology on mobile
|
|
31
|
+
|
|
32
|
+
- Restore the client → MCP Server → Runner layout on portrait screens, keeping
|
|
33
|
+
the central activity ring, animated call paths and node highlighting visible.
|
|
34
|
+
- Simplify mobile node labels while retaining touch-sized targets and direct
|
|
35
|
+
access to complete device and client permission settings.
|
|
36
|
+
- Center column titles and management actions, contain status text and scale
|
|
37
|
+
the activity ring to avoid text overlap on narrow screens.
|
|
38
|
+
- Refresh the mobile README screenshot and verify layout boundaries at 320,
|
|
39
|
+
390 and 430 pixels alongside the existing management workflows.
|
|
40
|
+
|
|
3
41
|
## 0.4.7 — Interactive control plane and mobile overview
|
|
4
42
|
|
|
5
43
|
- Add an interactive client → MCP Server → Runner topology with live audit
|
package/README.en.md
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
|
|
34
34
|
HomeAgent lets Claude, ChatGPT, Cursor and other MCP clients work on your own Linux / Windows development machines through a relay you host. Runners connect outbound and execute authorized file, command and Git operations locally, without opening inbound ports.
|
|
35
35
|
|
|
36
|
-
The execution system requires no model API key, hosted relay, telemetry or paid cloud service. Tool results are sent to the AI client you choose. Version **v0.4.
|
|
36
|
+
The execution system requires no model API key, hosted relay, telemetry or paid cloud service. Tool results are sent to the AI client you choose. Version **v0.4.9** supports one administrator and multiple devices.
|
|
37
37
|
|
|
38
38
|
## Why HomeAgent
|
|
39
39
|
|
|
@@ -54,9 +54,9 @@ Screenshots are rendered by a real browser using demo devices and projects in an
|
|
|
54
54
|
<details>
|
|
55
55
|
<summary><strong>View the mobile layout</strong></summary>
|
|
56
56
|
|
|
57
|
-
On phones,
|
|
57
|
+
On phones, a compact live topology keeps clients, the central MCP Server and Runners on the same screen, including the activity ring and call paths. Tap a node for its full settings; the segmented navigation opens the remaining management views.
|
|
58
58
|
|
|
59
|
-
<img src="docs/screenshots/dashboard-mobile.png" width="360" alt="HomeAgent mobile Dashboard:
|
|
59
|
+
<img src="docs/screenshots/dashboard-mobile.png" width="360" alt="HomeAgent mobile Dashboard: compact live client-to-MCP-to-Runner topology">
|
|
60
60
|
|
|
61
61
|
</details>
|
|
62
62
|
|
|
@@ -117,7 +117,7 @@ Install Docker Engine, Compose v2 and Git. Point your domain at the server and
|
|
|
117
117
|
allow inbound TCP ports 80/443. Replace `mcp.example.com` below with your domain.
|
|
118
118
|
|
|
119
119
|
```sh
|
|
120
|
-
git clone --branch v0.4.
|
|
120
|
+
git clone --branch v0.4.9 --depth 1 https://github.com/jhxxr/HomeAgent.git
|
|
121
121
|
cd HomeAgent
|
|
122
122
|
|
|
123
123
|
# Generate random secrets without installing Node.js on the host.
|
|
@@ -207,6 +207,12 @@ another configuration. Lookup order: explicit path, saved location,
|
|
|
207
207
|
`~/.homeagent/runner.json`.
|
|
208
208
|
For first-time setup and immediate startup, use `homeagent login --run`.
|
|
209
209
|
|
|
210
|
+
In an interactive terminal, startup shows the app icon, version, device name,
|
|
211
|
+
Server, configuration location and runtime details, with a live status line for
|
|
212
|
+
connecting, connected, reconnect countdown and stopped states. Piped output,
|
|
213
|
+
services and `homeagent run --plain` keep the single version log line for
|
|
214
|
+
systemd, scheduled tasks and scripts.
|
|
215
|
+
|
|
210
216
|
Enter Windows project paths such as `E:/Projects/my-app` in the Dashboard.
|
|
211
217
|
Keep configuration and state outside every exposed project. Local settings accept only connection and runtime options; project policies
|
|
212
218
|
come exclusively from the Server.
|
|
@@ -237,7 +243,13 @@ until the Server policy is synchronized again. Upgrade the Server and Runner to
|
|
|
237
243
|
| Dashboard | `https://mcp.example.com` |
|
|
238
244
|
| Client MCP endpoint | `https://mcp.example.com/mcp` |
|
|
239
245
|
| Runner `server` configuration | `https://mcp.example.com`, without `/mcp` |
|
|
240
|
-
| Health check | `https://mcp.example.com/health` |
|
|
246
|
+
| Health check | `https://mcp.example.com/health`, returns `version` and `runnerProtocol` |
|
|
247
|
+
|
|
248
|
+
Check versions with `homeagent-server --version` and `homeagent --version`; both
|
|
249
|
+
print the version, Node and platform, and `homeagent check-config` also lists the
|
|
250
|
+
Runner version. The Dashboard header, footer and Settings → 版本信息 show the
|
|
251
|
+
Server version plus each Runner's reported version and a match/upgrade hint. Keep
|
|
252
|
+
the Server and Runner on the same release when upgrading.
|
|
241
253
|
|
|
242
254
|
Use OAuth and approve the device/project permissions in your browser, or issue
|
|
243
255
|
a client token in the Dashboard with the intended `read / write / execute / git`
|
|
@@ -329,7 +341,7 @@ helpers. Each package has an explicit file list and license notices.
|
|
|
329
341
|
See [release preparation](docs/OPEN_SOURCE.md) to generate a reviewed source
|
|
330
342
|
archive. Nothing in the release commands automatically publishes or pushes it.
|
|
331
343
|
|
|
332
|
-
The `v0.4.
|
|
344
|
+
The `v0.4.9` release configuration produces separate `homeagent-server` and
|
|
333
345
|
`homeagent-runner` packages; local release commands do not upload to npm or push a
|
|
334
346
|
GitHub Release. For subsequent releases, increment the version and update the
|
|
335
347
|
version files and changelog before pushing a matching `vX.Y.Z` tag. Configure
|
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
|
|
34
34
|
HomeAgent 让 Claude、ChatGPT、Cursor 等 MCP 客户端,通过你部署的 Server 操作自己的 Linux / Windows 开发机器。Runner 主动连出,在本地执行授权的文件、命令和 Git 操作,无需开放被控端入站端口。
|
|
35
35
|
|
|
36
|
-
系统运行无需模型 API Key、第三方中继、遥测或付费云服务;工具结果会返回给你选择的 AI 客户端。当前版本 **v0.4.
|
|
36
|
+
系统运行无需模型 API Key、第三方中继、遥测或付费云服务;工具结果会返回给你选择的 AI 客户端。当前版本 **v0.4.9**,支持单管理员、多设备。
|
|
37
37
|
|
|
38
38
|
## 为什么使用 HomeAgent
|
|
39
39
|
|
|
@@ -54,9 +54,9 @@ HomeAgent 让 Claude、ChatGPT、Cursor 等 MCP 客户端,通过你部署的 S
|
|
|
54
54
|
<details>
|
|
55
55
|
<summary><strong>查看手机布局</strong></summary>
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
手机端保留「客户端 → MCP Server → Runner」同屏动态拓扑,通过紧凑节点、环形刻度和调用连线呈现开发网络;点击节点打开完整设置,其他功能通过顶部分段导航访问。
|
|
58
58
|
|
|
59
|
-
<img src="docs/screenshots/dashboard-mobile.png" width="360" alt="HomeAgent
|
|
59
|
+
<img src="docs/screenshots/dashboard-mobile.png" width="360" alt="HomeAgent 手机控制台:客户端、中央 MCP 与 Runner 同屏连接的动态拓扑">
|
|
60
60
|
|
|
61
61
|
</details>
|
|
62
62
|
|
|
@@ -111,7 +111,7 @@ Server 和 Runner 已拆成两个 npm 包,分别安装在中继服务器和需
|
|
|
111
111
|
准备 Docker Engine、Compose v2 和 Git,将自己的域名解析到服务器,并放行 TCP 80/443。下面以 `mcp.example.com` 为例,执行前替换成自己的域名。
|
|
112
112
|
|
|
113
113
|
```sh
|
|
114
|
-
git clone --branch v0.4.
|
|
114
|
+
git clone --branch v0.4.9 --depth 1 https://github.com/jhxxr/HomeAgent.git
|
|
115
115
|
cd HomeAgent
|
|
116
116
|
|
|
117
117
|
# 用容器生成随机密码和会话密钥,无需在宿主机安装 Node.js
|
|
@@ -175,6 +175,8 @@ homeagent run
|
|
|
175
175
|
|
|
176
176
|
Runner 自动记录成功登录或启动时的配置位置,切换工作目录后仍可直接使用 `homeagent run`。可通过 `homeagent run --config <路径>` 显式切换;查找顺序是显式路径、已记录路径、`~/.homeagent/runner.json`。首次登录也可使用 `homeagent login --run` 在批准后直接启动。
|
|
177
177
|
|
|
178
|
+
交互式终端启动时会显示应用图标、版本、设备名、Server、配置位置和运行时信息的启动画面,连接状态固定在下方实时更新(连接中、已连接、重连倒计时、已停止)。服务、管道输出或使用 `homeagent run --plain` 时保留单行版本日志,方便 systemd、计划任务和脚本采集。
|
|
179
|
+
|
|
178
180
|
Windows 的项目根目录可在网页中填为 `E:/Projects/my-app`。Runner 配置和 stateDir 都必须位于所有暴露项目之外。本地只维护连接信息、设备凭据和任务状态。
|
|
179
181
|
|
|
180
182
|
需要自启动时,完成配对并停止前台 Runner,再运行 `homeagent service-install`。Linux 安装用户 systemd 服务;Windows 安装当前用户登录时启动的计划任务。安装时自动识别配置位置,生成的服务固定使用该路径。
|
|
@@ -188,7 +190,9 @@ Windows 的项目根目录可在网页中填为 `E:/Projects/my-app`。Runner
|
|
|
188
190
|
| Dashboard | `https://mcp.example.com` |
|
|
189
191
|
| AI 客户端 MCP 地址 | `https://mcp.example.com/mcp` |
|
|
190
192
|
| Runner 配置的 `server` | `https://mcp.example.com`,不要加 `/mcp` |
|
|
191
|
-
| 健康检查 | `https://mcp.example.com/health` |
|
|
193
|
+
| 健康检查 | `https://mcp.example.com/health`,返回 `version` 与 `runnerProtocol` |
|
|
194
|
+
|
|
195
|
+
版本核对:`homeagent-server --version` 和 `homeagent --version` 会打印版本、Node 与平台;`homeagent check-config` 也会列出 Runner 版本。Dashboard 顶部、页脚和“连接与安全 → 版本信息”显示 Server 版本,以及每台 Runner 上报的版本和一致性提示。升级时 Server 与 Runner 应保持同一版本。
|
|
192
196
|
|
|
193
197
|
客户端可通过 OAuth 连接,在浏览器确认设备和项目权限;也可在 Dashboard 为已配对设备创建客户端令牌,选择 `read / write / execute / git` scope,再以 Bearer token 连接。令牌仅展示一次,设备凭据不能代替客户端令牌。
|
|
194
198
|
|
|
@@ -280,4 +284,4 @@ npm audit --omit=dev --audit-level=high
|
|
|
280
284
|
|
|
281
285
|
发布前执行 [开源与发布检查](docs/OPEN_SOURCE.md)。npm 发布会生成两个包:`homeagent-server` 只包含 Server/Web Dashboard,`homeagent-runner` 只包含 Runner、共享协议和 Windows 辅助程序;两者都采用明确的发布文件白名单。
|
|
282
286
|
|
|
283
|
-
`v0.4.
|
|
287
|
+
`v0.4.9` 的发布配置会分别生成 `homeagent-server` 和 `homeagent-runner`;本地发布命令不会自动上传 npm 或推送 GitHub。后续发布递增版本,更新版本文件和 changelog 后推送匹配标签;预发布使用 npm `next`,正式版本使用 `latest`。Token 权限、OIDC 切换和重试行为见 [自动发布说明](docs/OPEN_SOURCE.md#github-actions-自动发布)。
|
package/dist/runner/agent.js
CHANGED
|
@@ -9,6 +9,7 @@ export class Agent {
|
|
|
9
9
|
config;
|
|
10
10
|
credential;
|
|
11
11
|
log;
|
|
12
|
+
onState;
|
|
12
13
|
tools;
|
|
13
14
|
socket;
|
|
14
15
|
stopped = false;
|
|
@@ -26,10 +27,11 @@ export class Agent {
|
|
|
26
27
|
dirty = new Map();
|
|
27
28
|
flushTimer;
|
|
28
29
|
closing;
|
|
29
|
-
constructor(config, credential, log = console.log) {
|
|
30
|
+
constructor(config, credential, log = console.log, onState = () => { }) {
|
|
30
31
|
this.config = config;
|
|
31
32
|
this.credential = credential;
|
|
32
33
|
this.log = log;
|
|
34
|
+
this.onState = onState;
|
|
33
35
|
if (credential.server !== config.server)
|
|
34
36
|
throw new AppError('server_changed', 'Credential server mismatch');
|
|
35
37
|
config.projects = [];
|
|
@@ -78,6 +80,7 @@ export class Agent {
|
|
|
78
80
|
connect() {
|
|
79
81
|
if (this.stopped)
|
|
80
82
|
return;
|
|
83
|
+
this.onState('connecting');
|
|
81
84
|
const url = new URL('/runner', this.config.server);
|
|
82
85
|
url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
83
86
|
const socket = new WebSocket(url, { headers: { Authorization: `Bearer ${this.credential.token}`, 'X-Device-ID': this.credential.deviceId }, maxPayload: MAX_FRAME, perMessageDeflate: false, handshakeTimeout: 15000, followRedirects: false });
|
|
@@ -109,7 +112,8 @@ export class Agent {
|
|
|
109
112
|
return;
|
|
110
113
|
this.applyPermissions(message.permissions);
|
|
111
114
|
}).catch(() => socket.terminate());
|
|
112
|
-
this.log(`Runner connected · ${message.deviceId}`);
|
|
115
|
+
this.log(`Runner connected · ${message.deviceId} · v${VERSION}`);
|
|
116
|
+
this.onState('connected', message.deviceId.slice(0, 8));
|
|
113
117
|
void this.sendSnapshot(socket).catch(() => socket.terminate());
|
|
114
118
|
return;
|
|
115
119
|
}
|
|
@@ -190,8 +194,11 @@ export class Agent {
|
|
|
190
194
|
if (!this.stopped) {
|
|
191
195
|
const delay = Math.min(30000, 1000 * 2 ** Math.min(this.attempt++, 5)) + Math.random() * 500;
|
|
192
196
|
this.log(`Runner disconnected; reconnecting in ${Math.round(delay / 1000)}s`);
|
|
197
|
+
this.onState('reconnecting', `${Math.ceil(delay / 1000)}s`);
|
|
193
198
|
this.retry = setTimeout(() => this.connect(), delay);
|
|
194
199
|
}
|
|
200
|
+
else
|
|
201
|
+
this.onState('stopped');
|
|
195
202
|
});
|
|
196
203
|
}
|
|
197
204
|
async sendSnapshot(socket) {
|
|
@@ -231,6 +238,7 @@ export class Agent {
|
|
|
231
238
|
return this.closing;
|
|
232
239
|
this.stopped = true;
|
|
233
240
|
this.ready = false;
|
|
241
|
+
this.onState('stopped');
|
|
234
242
|
if (this.retry)
|
|
235
243
|
clearTimeout(this.retry);
|
|
236
244
|
if (this.watchdog)
|
package/dist/runner/cli.js
CHANGED
|
@@ -1,17 +1,36 @@
|
|
|
1
1
|
import { parseArgs } from 'node:util';
|
|
2
|
+
import os from 'node:os';
|
|
2
3
|
import { loadRunnerConfig } from './config.js';
|
|
3
4
|
import { loadCredential, secureStateDirectory } from './credentials.js';
|
|
4
5
|
import { Agent } from './agent.js';
|
|
5
6
|
import { service } from './service.js';
|
|
6
7
|
import { interactiveLogin } from './setup.js';
|
|
7
8
|
import { rememberRunnerConfigPath, resolveRunnerConfigPath } from './config-location.js';
|
|
9
|
+
import { RunnerTui, tuiEnabled } from './tui.js';
|
|
8
10
|
import { VERSION } from '../shared/protocol.js';
|
|
9
|
-
|
|
11
|
+
import { versionBanner } from '../shared/version.js';
|
|
12
|
+
function shortenHome(filename) {
|
|
13
|
+
const home = os.homedir();
|
|
14
|
+
if (!filename.toLowerCase().startsWith(home.toLowerCase()))
|
|
15
|
+
return filename;
|
|
16
|
+
const rest = filename.slice(home.length);
|
|
17
|
+
return rest === '' || rest.startsWith('/') || rest.startsWith('\\') ? '~' + rest : filename;
|
|
18
|
+
}
|
|
19
|
+
async function startRunner(config, filename, plain = false) {
|
|
10
20
|
await secureStateDirectory(config.stateDir);
|
|
11
21
|
const credential = await loadCredential(config);
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
22
|
+
const tui = !plain && tuiEnabled(process.stdout) ? new RunnerTui({
|
|
23
|
+
version: VERSION, node: process.version, platform: process.platform, arch: process.arch,
|
|
24
|
+
device: config.name, server: config.server, config: shortenHome(filename),
|
|
25
|
+
}) : undefined;
|
|
26
|
+
const agent = new Agent(config, credential, tui ? message => tui.log(message) : console.log, tui ? (state, detail) => tui.setState(state, detail) : undefined);
|
|
27
|
+
if (tui)
|
|
28
|
+
tui.start();
|
|
29
|
+
else {
|
|
30
|
+
console.log(versionBanner('Runner'));
|
|
31
|
+
console.log(`Runner 配置:${filename}`);
|
|
32
|
+
}
|
|
33
|
+
await rememberRunnerConfigPath(filename).catch(() => (tui ? tui.log('无法记录配置位置,下次启动请通过 --config 指定路径。') : console.error('无法记录配置位置,下次启动请通过 --config 指定路径。')));
|
|
15
34
|
agent.start();
|
|
16
35
|
let closing = false;
|
|
17
36
|
for (const signal of ['SIGINT', 'SIGTERM'])
|
|
@@ -19,8 +38,8 @@ async function startRunner(config, filename) {
|
|
|
19
38
|
if (closing)
|
|
20
39
|
return;
|
|
21
40
|
closing = true;
|
|
22
|
-
const timer = setTimeout(() => process.exit(1), 10000).unref();
|
|
23
|
-
void agent.close().then(() => { clearTimeout(timer); process.exit(0); });
|
|
41
|
+
const timer = setTimeout(() => { tui?.stop(); process.exit(1); }, 10000).unref();
|
|
42
|
+
void agent.close().then(() => { clearTimeout(timer); tui?.stop(); process.exit(0); });
|
|
24
43
|
});
|
|
25
44
|
}
|
|
26
45
|
try {
|
|
@@ -28,32 +47,33 @@ try {
|
|
|
28
47
|
allowPositionals: true,
|
|
29
48
|
options: {
|
|
30
49
|
config: { type: 'string' }, server: { type: 'string' }, name: { type: 'string' },
|
|
31
|
-
force: { type: 'boolean', default: false },
|
|
50
|
+
force: { type: 'boolean', default: false }, plain: { type: 'boolean', default: false },
|
|
32
51
|
run: { type: 'boolean', default: false }, help: { type: 'boolean', default: false }, version: { type: 'boolean', default: false },
|
|
33
52
|
},
|
|
34
53
|
});
|
|
35
54
|
if (values.help) {
|
|
36
|
-
console.log(
|
|
55
|
+
console.log(`HomeAgent Runner ${VERSION}\n login [--config <path>] [--server URL] [--name NAME] [--run] [--force] [--plain]\n run [--config <path>] [--plain]\n check-config [--config <path>]\n service-install [--config <path>]\n service-uninstall [--config <path>]\n --version\n\nConfiguration: explicit --config, saved location, ~/.homeagent/runner.json.\nUse homeagent login to set up a device and homeagent run to start it.\n--plain prints one line per event instead of the interactive startup card.\nProject directories and permissions are configured on the Web.`);
|
|
37
56
|
}
|
|
38
57
|
else if (values.version)
|
|
39
|
-
console.log(
|
|
58
|
+
console.log(versionBanner('Runner'));
|
|
40
59
|
else {
|
|
41
60
|
const command = positionals[0] ?? 'run';
|
|
42
61
|
if (positionals.length > 1 || !['login', 'run', 'check-config', 'service-install', 'service-uninstall'].includes(command))
|
|
43
62
|
throw new Error(`Unknown command: ${positionals.join(' ')}. Use homeagent --help.`);
|
|
44
63
|
if (command === 'login') {
|
|
64
|
+
console.log(versionBanner('Runner'));
|
|
45
65
|
const result = await interactiveLogin({ config: values.config, server: values.server, name: values.name, force: values.force });
|
|
46
66
|
if (values.run)
|
|
47
|
-
await startRunner(result.config, result.filename);
|
|
67
|
+
await startRunner(result.config, result.filename, values.plain);
|
|
48
68
|
}
|
|
49
69
|
else {
|
|
50
70
|
const filename = await resolveRunnerConfigPath(values.config), config = await loadRunnerConfig(filename);
|
|
51
71
|
if (command === 'check-config')
|
|
52
|
-
console.log(JSON.stringify({ valid: true, configFile: filename, server: config.server, projectConfiguration: 'server-managed', maxProcesses: config.maxProcesses }, null, 2));
|
|
72
|
+
console.log(JSON.stringify({ valid: true, version: VERSION, node: process.version, platform: process.platform, architecture: process.arch, configFile: filename, server: config.server, projectConfiguration: 'server-managed', maxProcesses: config.maxProcesses }, null, 2));
|
|
53
73
|
else if (command === 'service-install' || command === 'service-uninstall')
|
|
54
74
|
await service(config, filename, command === 'service-uninstall');
|
|
55
75
|
else if (command === 'run')
|
|
56
|
-
await startRunner(config, filename);
|
|
76
|
+
await startRunner(config, filename, values.plain);
|
|
57
77
|
else
|
|
58
78
|
throw new Error(`Unknown command: ${command}`);
|
|
59
79
|
}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { stripVTControlCharacters } from 'node:util';
|
|
2
|
+
import { VERSION } from '../shared/protocol.js';
|
|
3
|
+
const ESC = '\x1b[';
|
|
4
|
+
const RESET = `${ESC}0m`;
|
|
5
|
+
const LOGO = [
|
|
6
|
+
' ................ ',
|
|
7
|
+
' .................... ',
|
|
8
|
+
' ...................... ',
|
|
9
|
+
' ..................o... ',
|
|
10
|
+
'..................+o+...',
|
|
11
|
+
'.................+oooo..',
|
|
12
|
+
'..............+###+o+...',
|
|
13
|
+
'..............####+o....',
|
|
14
|
+
'...+############+#+.....',
|
|
15
|
+
'...############++##.....',
|
|
16
|
+
'...#+............+#+....',
|
|
17
|
+
'...#+.+..........+#+....',
|
|
18
|
+
'...#+.##+........+#+....',
|
|
19
|
+
'...#+.+##+.......+#+....',
|
|
20
|
+
'...#+...##+......+#+....',
|
|
21
|
+
'...#+..###+......+#+....',
|
|
22
|
+
'...#+.##+.++++++.+#+....',
|
|
23
|
+
'...#+.++..#####+.+#+....',
|
|
24
|
+
'...#+............+#+....',
|
|
25
|
+
'...##++++++++++++##.....',
|
|
26
|
+
' ..+##############+.... ',
|
|
27
|
+
' ...................... ',
|
|
28
|
+
' .................... ',
|
|
29
|
+
' ................ ',
|
|
30
|
+
];
|
|
31
|
+
const PALETTE = {
|
|
32
|
+
'.': '243;249;253',
|
|
33
|
+
'#': '7;85;255',
|
|
34
|
+
'o': '255;101;62',
|
|
35
|
+
'+': '224;235;252',
|
|
36
|
+
};
|
|
37
|
+
const BRAND = {
|
|
38
|
+
blue: '38;2;7;85;255',
|
|
39
|
+
orange: '38;2;255;101;62',
|
|
40
|
+
border: '38;2;106;120;140',
|
|
41
|
+
green: '38;2;63;185;80',
|
|
42
|
+
yellow: '38;2;210;153;34',
|
|
43
|
+
red: '38;2;248;81;73',
|
|
44
|
+
dim: '2',
|
|
45
|
+
bold: '1',
|
|
46
|
+
};
|
|
47
|
+
const SPINNER = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
48
|
+
const SEGMENTS = new Intl.Segmenter(undefined, { granularity: 'grapheme' });
|
|
49
|
+
const WIDE = /[ᄀ-ᅟ⺀-〾ぁ-㏿㐀-䶿一-鿿ꀀ-가-힣豈-︐-︙︰-﹫-⦆¢-₩]/;
|
|
50
|
+
export function stripAnsi(text) {
|
|
51
|
+
return stripVTControlCharacters(text);
|
|
52
|
+
}
|
|
53
|
+
/** Keep configuration and remote messages from injecting terminal commands. */
|
|
54
|
+
function safeText(text) {
|
|
55
|
+
return stripAnsi(text).replace(/[\p{Cc}\p{Cf}]/gu, char => char === '\u200d' ? char : '');
|
|
56
|
+
}
|
|
57
|
+
function cellWidth(segment) {
|
|
58
|
+
if (/^[\p{Mark}\p{Cf}]+$/u.test(segment))
|
|
59
|
+
return 0;
|
|
60
|
+
if (/\p{Emoji_Presentation}|\uFE0F|\u20E3/u.test(segment))
|
|
61
|
+
return 2;
|
|
62
|
+
return WIDE.test(segment) ? 2 : 1;
|
|
63
|
+
}
|
|
64
|
+
/** Terminal cells, including CJK, combining accents and emoji clusters. */
|
|
65
|
+
export function displayWidth(text) {
|
|
66
|
+
return [...SEGMENTS.segment(stripAnsi(text))].reduce((width, { segment }) => width + cellWidth(segment), 0);
|
|
67
|
+
}
|
|
68
|
+
export function truncate(text, width) {
|
|
69
|
+
if (width <= 0)
|
|
70
|
+
return '';
|
|
71
|
+
if (displayWidth(text) <= width)
|
|
72
|
+
return text;
|
|
73
|
+
let result = '', used = 0;
|
|
74
|
+
for (const { segment } of SEGMENTS.segment(stripAnsi(text))) {
|
|
75
|
+
const size = cellWidth(segment);
|
|
76
|
+
if (used + size > width - 1)
|
|
77
|
+
break;
|
|
78
|
+
result += segment;
|
|
79
|
+
used += size;
|
|
80
|
+
}
|
|
81
|
+
return result + '…';
|
|
82
|
+
}
|
|
83
|
+
function cardLayout(options) {
|
|
84
|
+
// Leave the last cell unused to avoid terminal autowrap during live updates.
|
|
85
|
+
const columns = Math.max(1, Math.floor(options.columns ?? 80));
|
|
86
|
+
const width = Math.max(0, Math.min(Math.floor(options.width ?? 96), columns - 1));
|
|
87
|
+
return { columns, width, indent: ' '.repeat(Math.max(0, Math.floor((columns - width) / 2))) };
|
|
88
|
+
}
|
|
89
|
+
function paint(text, code, color) {
|
|
90
|
+
return color ? `${ESC}${code}m${text}${RESET}` : text;
|
|
91
|
+
}
|
|
92
|
+
/** Render the app mark as half blocks: 24 columns wide, 12 rows tall. */
|
|
93
|
+
export function renderLogo(color) {
|
|
94
|
+
const lines = [];
|
|
95
|
+
for (let row = 0; row < LOGO.length; row += 2) {
|
|
96
|
+
const upper = LOGO[row];
|
|
97
|
+
const lower = LOGO[row + 1];
|
|
98
|
+
let line = '';
|
|
99
|
+
for (let x = 0; x < upper.length; x++) {
|
|
100
|
+
const top = upper[x] ?? ' ';
|
|
101
|
+
const bottom = lower?.[x] ?? ' ';
|
|
102
|
+
const topFilled = color ? top !== ' ' : top !== ' ' && top !== '.';
|
|
103
|
+
const bottomFilled = color ? bottom !== ' ' : bottom !== ' ' && bottom !== '.';
|
|
104
|
+
if (!topFilled && !bottomFilled) {
|
|
105
|
+
line += ' ';
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (!color) {
|
|
109
|
+
line += topFilled && bottomFilled ? '█' : topFilled ? '▀' : '▄';
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (topFilled && bottomFilled)
|
|
113
|
+
line += `${ESC}38;2;${PALETTE[top]}m${ESC}48;2;${PALETTE[bottom]}m▀`;
|
|
114
|
+
else if (topFilled)
|
|
115
|
+
line += `${ESC}38;2;${PALETTE[top]}m${ESC}49m▀`;
|
|
116
|
+
else
|
|
117
|
+
line += `${ESC}38;2;${PALETTE[bottom]}m${ESC}49m▄`;
|
|
118
|
+
}
|
|
119
|
+
lines.push(color ? line + RESET : line);
|
|
120
|
+
}
|
|
121
|
+
return lines;
|
|
122
|
+
}
|
|
123
|
+
/** Startup card shown by `homeagent run` in an interactive terminal. */
|
|
124
|
+
export function renderRunnerCard(info, options = {}) {
|
|
125
|
+
const { width, indent } = cardLayout(options);
|
|
126
|
+
const color = options.color ?? false;
|
|
127
|
+
const title = paint('HomeAgent Runner', `${BRAND.bold};${BRAND.blue}`, color);
|
|
128
|
+
const version = paint(`v${safeText(info.version ?? VERSION)}`, BRAND.dim, color);
|
|
129
|
+
const entries = [
|
|
130
|
+
['设备', info.device], ['服务', info.server], ['配置', info.config],
|
|
131
|
+
['环境', `${info.node} · ${info.platform}/${info.arch}`],
|
|
132
|
+
];
|
|
133
|
+
const hint = 'Ctrl+C 停止 · 项目与权限在网页端配置';
|
|
134
|
+
if (width < 32)
|
|
135
|
+
return [
|
|
136
|
+
`HomeAgent Runner v${safeText(info.version ?? VERSION)}`,
|
|
137
|
+
...entries.map(([label, value]) => `${label} ${safeText(value)}`),
|
|
138
|
+
'Ctrl+C 停止',
|
|
139
|
+
].map(line => indent + truncate(line, width));
|
|
140
|
+
const inner = width - 4;
|
|
141
|
+
const border = (text) => paint(text, BRAND.border, color);
|
|
142
|
+
const lines = [border('╭' + '─'.repeat(width - 2) + '╮')];
|
|
143
|
+
const row = (content = '') => {
|
|
144
|
+
const text = truncate(content, inner);
|
|
145
|
+
lines.push(border('│') + ' ' + text + ' '.repeat(Math.max(0, inner - displayWidth(text))) + ' ' + border('│'));
|
|
146
|
+
};
|
|
147
|
+
const entry = ([label, value]) => paint(label, BRAND.dim, color) + ' ' + safeText(value);
|
|
148
|
+
if (width >= 76) {
|
|
149
|
+
const detailWidth = inner - 28;
|
|
150
|
+
const details = ['', title, version, '', ...entries.map(entry), '', paint(truncate(hint, detailWidth), BRAND.dim, color)];
|
|
151
|
+
renderLogo(color).forEach((logo, index) => {
|
|
152
|
+
const detail = truncate(details[index] ?? '', detailWidth);
|
|
153
|
+
row(logo + ' ' + border('│') + ' ' + detail);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
row(title + ' ' + version);
|
|
158
|
+
row();
|
|
159
|
+
for (const value of entries)
|
|
160
|
+
row(entry(value));
|
|
161
|
+
row();
|
|
162
|
+
row(paint(truncate(hint, inner), BRAND.dim, color));
|
|
163
|
+
}
|
|
164
|
+
lines.push(border('╰' + '─'.repeat(width - 2) + '╯'));
|
|
165
|
+
return lines.map(line => indent + line);
|
|
166
|
+
}
|
|
167
|
+
export function renderStatus(state, detail, color, frame = 0) {
|
|
168
|
+
const dot = (glyph, code) => paint(glyph, code, color);
|
|
169
|
+
switch (state) {
|
|
170
|
+
case 'connecting':
|
|
171
|
+
return `${dot(SPINNER[frame % SPINNER.length], BRAND.orange)} ${paint('正在连接 Server…', BRAND.dim, color)}`;
|
|
172
|
+
case 'connected':
|
|
173
|
+
return `${dot('●', BRAND.green)} 已连接${detail ? paint(` · ${detail}`, BRAND.dim, color) : ''}`;
|
|
174
|
+
case 'reconnecting':
|
|
175
|
+
return `${dot(SPINNER[frame % SPINNER.length], BRAND.yellow)} 连接中断${detail ? paint(` · ${detail} 后重试`, BRAND.dim, color) : ''}`;
|
|
176
|
+
case 'stopped':
|
|
177
|
+
return `${dot('■', BRAND.red)} 已停止`;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
export function tuiEnabled(stream = process.stdout, env = process.env) {
|
|
181
|
+
if (env.HOMEAGENT_TUI === '0' || env.HOMEAGENT_TUI === 'plain')
|
|
182
|
+
return false;
|
|
183
|
+
if (!stream.isTTY || env.TERM === 'dumb')
|
|
184
|
+
return false;
|
|
185
|
+
if (env.HOMEAGENT_TUI === '1')
|
|
186
|
+
return true;
|
|
187
|
+
return env.CI === undefined;
|
|
188
|
+
}
|
|
189
|
+
export function colorEnabled(env = process.env) {
|
|
190
|
+
if (Object.hasOwn(env, 'NO_COLOR'))
|
|
191
|
+
return false;
|
|
192
|
+
if (env.FORCE_COLOR === '0')
|
|
193
|
+
return false;
|
|
194
|
+
if (env.TERM === 'dumb')
|
|
195
|
+
return false;
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
/** The icon relies on 24-bit color; degrade to the monochrome mark elsewhere. */
|
|
199
|
+
export function truecolorEnabled(stream = process.stdout, env = process.env) {
|
|
200
|
+
if (!colorEnabled(env))
|
|
201
|
+
return false;
|
|
202
|
+
if (env.COLORTERM && /truecolor|24bit/i.test(env.COLORTERM))
|
|
203
|
+
return true;
|
|
204
|
+
if (env.WT_SESSION || /^(?:vscode|iTerm\.app|WezTerm|Apple_Terminal)$/i.test(env.TERM_PROGRAM ?? ''))
|
|
205
|
+
return true;
|
|
206
|
+
return typeof stream.getColorDepth === 'function' && stream.getColorDepth() >= 24;
|
|
207
|
+
}
|
|
208
|
+
/** Keep the connection status on one line below the log stream. */
|
|
209
|
+
export class RunnerTui {
|
|
210
|
+
info;
|
|
211
|
+
options;
|
|
212
|
+
timer;
|
|
213
|
+
exitHandler;
|
|
214
|
+
state = 'connecting';
|
|
215
|
+
detail;
|
|
216
|
+
retryAt;
|
|
217
|
+
frame = 0;
|
|
218
|
+
statusDrawn = false;
|
|
219
|
+
started = false;
|
|
220
|
+
constructor(info, options = {}) {
|
|
221
|
+
this.info = info;
|
|
222
|
+
this.options = options;
|
|
223
|
+
}
|
|
224
|
+
get stream() { return this.options.stream ?? process.stdout; }
|
|
225
|
+
get color() { return this.options.color ?? truecolorEnabled(this.stream, process.env); }
|
|
226
|
+
get indent() {
|
|
227
|
+
return cardLayout({ ...this.options, columns: this.options.columns ?? this.stream.columns }).indent;
|
|
228
|
+
}
|
|
229
|
+
start() {
|
|
230
|
+
if (this.started)
|
|
231
|
+
return;
|
|
232
|
+
this.started = true;
|
|
233
|
+
const columns = this.options.columns ?? this.stream.columns ?? 80;
|
|
234
|
+
this.stream.write(renderRunnerCard(this.info, { ...this.options, columns, color: this.color }).join('\n') + '\n\n');
|
|
235
|
+
this.stream.write(`${ESC}?25l`);
|
|
236
|
+
this.exitHandler = () => this.stream.write(`${ESC}?25h`);
|
|
237
|
+
process.on('exit', this.exitHandler);
|
|
238
|
+
this.draw();
|
|
239
|
+
this.timer = setInterval(() => {
|
|
240
|
+
this.frame += 1;
|
|
241
|
+
if (this.state === 'connecting' || this.state === 'reconnecting')
|
|
242
|
+
this.draw();
|
|
243
|
+
}, 90);
|
|
244
|
+
this.timer.unref();
|
|
245
|
+
}
|
|
246
|
+
setState(state, detail) {
|
|
247
|
+
if (state === 'stopped' && this.started) {
|
|
248
|
+
this.stop();
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
this.state = state;
|
|
252
|
+
this.detail = detail;
|
|
253
|
+
this.retryAt = state === 'reconnecting' && /^\d+s$/.test(detail ?? '') ? Date.now() + Number(detail.slice(0, -1)) * 1000 : undefined;
|
|
254
|
+
if (state === 'connected' || state === 'stopped') {
|
|
255
|
+
if (this.timer)
|
|
256
|
+
clearInterval(this.timer);
|
|
257
|
+
this.timer = undefined;
|
|
258
|
+
}
|
|
259
|
+
else if (this.started && !this.timer) {
|
|
260
|
+
this.timer = setInterval(() => { this.frame += 1; this.draw(); }, 90);
|
|
261
|
+
this.timer.unref();
|
|
262
|
+
}
|
|
263
|
+
if (this.started)
|
|
264
|
+
this.draw();
|
|
265
|
+
}
|
|
266
|
+
log(message) {
|
|
267
|
+
const text = message.split(/\r?\n/).map(safeText).join('\n') + '\n';
|
|
268
|
+
if (!this.started) {
|
|
269
|
+
this.stream.write(text);
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
this.clearLine();
|
|
273
|
+
this.stream.write(text);
|
|
274
|
+
this.draw();
|
|
275
|
+
}
|
|
276
|
+
stop() {
|
|
277
|
+
if (!this.started)
|
|
278
|
+
return;
|
|
279
|
+
if (this.timer)
|
|
280
|
+
clearInterval(this.timer);
|
|
281
|
+
this.timer = undefined;
|
|
282
|
+
this.clearLine();
|
|
283
|
+
this.state = 'stopped';
|
|
284
|
+
const columns = this.options.columns ?? this.stream.columns ?? 80;
|
|
285
|
+
this.stream.write(this.indent + truncate(renderStatus('stopped', undefined, this.color, this.frame), Math.max(0, columns - this.indent.length - 1)) + '\n');
|
|
286
|
+
this.stream.write(`${ESC}?25h`);
|
|
287
|
+
if (this.exitHandler) {
|
|
288
|
+
process.off('exit', this.exitHandler);
|
|
289
|
+
this.exitHandler = undefined;
|
|
290
|
+
}
|
|
291
|
+
this.started = false;
|
|
292
|
+
}
|
|
293
|
+
draw() {
|
|
294
|
+
const columns = Math.max(1, this.options.columns ?? this.stream.columns ?? 80);
|
|
295
|
+
const detail = this.retryAt === undefined ? this.detail : `${Math.max(0, Math.ceil((this.retryAt - Date.now()) / 1000))}s`;
|
|
296
|
+
const status = renderStatus(this.state, detail ? safeText(detail) : undefined, this.color, this.frame);
|
|
297
|
+
const indent = this.indent;
|
|
298
|
+
this.stream.write('\r' + `${ESC}2K` + indent + truncate(status, Math.max(0, columns - indent.length - 1)));
|
|
299
|
+
this.statusDrawn = true;
|
|
300
|
+
}
|
|
301
|
+
clearLine() {
|
|
302
|
+
if (!this.statusDrawn)
|
|
303
|
+
return;
|
|
304
|
+
this.stream.write('\r' + `${ESC}2K`);
|
|
305
|
+
this.statusDrawn = false;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
//# sourceMappingURL=tui.js.map
|
package/dist/shared/protocol.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { remotePermissionsSchema } from './permissions.js';
|
|
3
|
-
export const VERSION = '0.4.
|
|
3
|
+
export const VERSION = '0.4.9';
|
|
4
4
|
export const RUNNER_PROTOCOL = 2;
|
|
5
5
|
export const MAX_FRAME = 2 * 1024 * 1024;
|
|
6
6
|
export const SCOPES = ['read', 'write', 'execute', 'git'];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { VERSION } from './protocol.js';
|
|
2
|
+
/** Human-readable version line shared by the Server and Runner CLIs. */
|
|
3
|
+
export const versionBanner = (component) => `HomeAgent ${component} v${VERSION} · Node ${process.version} · ${process.platform}/${process.arch}`;
|
|
4
|
+
//# sourceMappingURL=version.js.map
|
package/docs/CLIENTS.md
CHANGED
|
@@ -14,7 +14,7 @@ v0.3 日常编码优先采用 [开发工作流](DEVELOPMENT_WORKFLOW.md):get_p
|
|
|
14
14
|
|
|
15
15
|
v0.3.0 的授权表单直接重定向到外部回调,Chrome 可能按 `form-action 'self'` 拦截该跳转;授权请求却已被消费,第二次点击便显示 `Authorization request expired`。**升级 Server 到 v0.3.1**:新版本先进入站内完成页,再返回已注册客户端,保留严格 CSP;按钮显示提交状态并防止重复提交。
|
|
16
16
|
|
|
17
|
-
升级后重启 Server,回到 AI 客户端重新发起 OAuth 授权,不要刷新或重复提交旧标签页。npm 部署升级 `homeagent-server` 包后重启对应服务;Runner 使用独立的 `homeagent-runner` 包,两者应升级到相同版本。Compose 部署检出 v0.4.
|
|
17
|
+
升级后重启 Server,回到 AI 客户端重新发起 OAuth 授权,不要刷新或重复提交旧标签页。npm 部署升级 `homeagent-server` 包后重启对应服务;Runner 使用独立的 `homeagent-runner` 包,两者应升级到相同版本。Compose 部署检出 v0.4.9 后重新构建并启动,保留原 `.env` 和数据卷。Runner v0.3.0 不需要为 OAuth 回调修复升级;要使用 v0.4 的 Web 权限管理,则 Server 和 Runner 都应升级到 v0.4.9。
|
|
18
18
|
|
|
19
19
|
若完成页没有自动返回,点击“继续返回客户端”。已使用或过期的授权码不会被重新签发;客户端仍未连接时,从客户端新建一次授权请求。设备凭据及已完成的客户端授权不因升级被主动清空。
|
|
20
20
|
|
package/docs/DEPLOYMENT.md
CHANGED
|
@@ -95,7 +95,7 @@ journalctl --user -u homeagent-server -f
|
|
|
95
95
|
先在有 Docker Engine、Compose v2 和 Git 的服务器检出发布源码:
|
|
96
96
|
|
|
97
97
|
```sh
|
|
98
|
-
git clone --branch v0.4.
|
|
98
|
+
git clone --branch v0.4.9 --depth 1 https://github.com/jhxxr/HomeAgent.git
|
|
99
99
|
cd HomeAgent
|
|
100
100
|
```
|
|
101
101
|
|
|
@@ -196,7 +196,9 @@ Runner 首次连接时没有项目权限,收到 Server 配置并验证成功
|
|
|
196
196
|
5. 凭据保存到 stateDir/device.json;Linux 目录 0700、文件 0600,Windows CLI 对目录设置当前账户和 SYSTEM 的受限 ACL。配对与运行使用同一 stateDir 互斥锁;先停止正在运行的实例再重新配对。
|
|
197
197
|
6. 登录完成后执行 `homeagent run`;Dashboard 应显示在线及注册项目,终端打印当前生效目录。首次也可用 `homeagent login --run` 在批准后直接启动。
|
|
198
198
|
|
|
199
|
-
配置检查使用 `homeagent check-config
|
|
199
|
+
配置检查使用 `homeagent check-config`,仅显示本机连接、Runner 版本和运行设置。终端在收到 Server 配置后显示实际应用的目录。
|
|
200
|
+
|
|
201
|
+
启动或登录时终端会打印 `HomeAgent Runner v<版本> · Node <版本> · <平台>/<架构>`,Server 启动时同样打印自身版本。交互式终端(`homeagent run`)会显示应用图标与运行详情的左右分栏启动卡片,窄终端自动使用紧凑布局,并在下方实时更新连接状态和重连倒计时;服务、重定向输出或 `--plain` 仍使用单行版本日志,`NO_COLOR` 或非真彩色终端降级为单色启动画面。Dashboard 顶部与页脚显示 Server 版本,“连接与安全 → 版本信息”列出 Server、Runner 协议以及每台设备上报的 Runner 版本,并对与 Server 不一致的 Runner 给出升级提示。`GET /health` 与 `GET /api/state` 也返回版本字段,便于部署脚本核对。`HOMEAGENT_TUI=0`(或 `plain`)关闭交互展示;`HOMEAGENT_TUI=1` 可在 CI 的交互终端中启用,但管道输出和 `TERM=dumb` 始终使用普通日志。
|
|
200
202
|
|
|
201
203
|
配对超时或领取响应丢失时重新开始,旧配对不会返回长期明文凭据。如果本地已经有凭据,`login` 默认拒绝覆盖;显式 `homeagent login --force` 会替换本地凭据,但不会自动撤销 Server 上的旧设备,应先在 Dashboard 撤销旧记录。
|
|
202
204
|
|
package/docs/OPEN_SOURCE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 开源仓库与源码发布
|
|
2
2
|
|
|
3
|
-
本仓库以 MIT 开放原始代码,版本为 0.4.
|
|
3
|
+
本仓库以 MIT 开放原始代码,版本为 0.4.9,npm 发布拆成 `homeagent-server` 和 `homeagent-runner` 两个包。Server 包只包含编译后的 Server、Dashboard 和 Server 资源;Runner 包只包含 Runner、共享协议和 Windows 进程树辅助代码。CLI 和源码采用相同许可证;两个 npm 包都通过文件白名单只包含运行所需文件、文档和许可证。包名是否可用及账号发布权限以发布当时的 registry 为准。
|
|
4
4
|
|
|
5
5
|
## 文件划分
|
|
6
6
|
|
|
@@ -53,7 +53,7 @@ npm run release:source
|
|
|
53
53
|
|
|
54
54
|
输出位于被忽略的 release/:
|
|
55
55
|
|
|
56
|
-
- `HomeAgent-v0.4.
|
|
56
|
+
- `HomeAgent-v0.4.9-source.tar.gz`
|
|
57
57
|
- 对应 `.sha256` 校验文件
|
|
58
58
|
- 对应 `.manifest.txt`,包括版本、Git 提交和全部发布路径
|
|
59
59
|
|
|
@@ -65,8 +65,8 @@ npm run release:source
|
|
|
65
65
|
|
|
66
66
|
`npm run release:npm` 构建 JavaScript、以 `--ignore-scripts` 分别打包两个包,并检查归档文件白名单、运行资源及 SHA-512 完整性,输出:
|
|
67
67
|
|
|
68
|
-
- `release/homeagent-server-0.4.
|
|
69
|
-
- `release/homeagent-runner-0.4.
|
|
68
|
+
- `release/homeagent-server-0.4.9.tgz`
|
|
69
|
+
- `release/homeagent-runner-0.4.9.tgz`
|
|
70
70
|
- 两个归档各自的 `.sha256`
|
|
71
71
|
- `release/npm-packages.json`:两个包的名称、版本、Git commit、校验、dist-tag 和路径清单
|
|
72
72
|
|
|
@@ -76,20 +76,20 @@ npm run release:source
|
|
|
76
76
|
|
|
77
77
|
`.github/workflows/release.yml` 支持两种入口:
|
|
78
78
|
|
|
79
|
-
1. 推送版本标签,例如 `v0.4.
|
|
79
|
+
1. 推送版本标签,例如 `v0.4.9`。
|
|
80
80
|
2. 在 Actions → release → Run workflow 中填写**已经存在**的版本标签。
|
|
81
81
|
|
|
82
82
|
先按下一节配置 `NPM_TOKEN`。首次推送源码、配置真实 `origin` 并确认 Actions 可用后,可以按下面方式发布:
|
|
83
83
|
|
|
84
84
|
```sh
|
|
85
85
|
# 先提交本次版本的源码和文档,工作区保持干净
|
|
86
|
-
git tag -a v0.4.
|
|
87
|
-
git push origin v0.4.
|
|
86
|
+
git tag -a v0.4.9 -m "HomeAgent v0.4.9"
|
|
87
|
+
git push origin v0.4.9
|
|
88
88
|
```
|
|
89
89
|
|
|
90
90
|
本文只是发布说明,准备脚本不会替操作者执行这些命令。
|
|
91
91
|
|
|
92
|
-
标签必须与 package.json、package-lock.json 及 runtime VERSION 一致,CHANGELOG.md 必须有对应版本的非空条目。预发布可用 `v0.4.
|
|
92
|
+
标签必须与 package.json、package-lock.json 及 runtime VERSION 一致,CHANGELOG.md 必须有对应版本的非空条目。预发布可用 `v0.4.9-rc.1`(相关版本文件也必须为 `0.4.9-rc.1`)。禁止把普通分支或不匹配版本伪装成发布。
|
|
93
93
|
|
|
94
94
|
发布流水线按次序执行:
|
|
95
95
|
|
package/docs/TOOLS.md
CHANGED
|
@@ -83,8 +83,8 @@ Windows 需要系统 PowerShell/.NET 的 Add-Type 能力,使用本项目 runti
|
|
|
83
83
|
|
|
84
84
|
| 方法 | 路径 | 用途 |
|
|
85
85
|
| --- | --- | --- |
|
|
86
|
-
| GET | /health |
|
|
87
|
-
| GET | /api/state | 设备、客户端活动、最近审计、当前 CSRF |
|
|
86
|
+
| GET | /health | 健康与数据库探测,返回 Server `version` 与 `runnerProtocol` |
|
|
87
|
+
| GET | /api/state | 设备、客户端活动、最近审计、当前 CSRF,以及 Server `version`、`runnerProtocol` 和 Node/平台信息 |
|
|
88
88
|
| GET | /api/jobs?deviceId=UUID&projectId=ID&limit=200 | 有界持久任务元数据,最多 1000 项 |
|
|
89
89
|
| GET | /api/jobs/:deviceId/:id/output?cursor=0&length=65536 | 管理员按准确实例读取 Runner 输出,不保存到 Server |
|
|
90
90
|
| GET | /api/jobs/:deviceId/:id/output?view=tail&length=65536 | v0.3 环形尾部;可用绝对 cursor 继续,返回覆盖提示 |
|
|
Binary file
|
package/package.json
CHANGED