homeagent-runner 0.4.12 → 0.4.13

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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.13 — Clear program permissions
4
+
5
+ - Expose an explicit “Allow all programs” control in both device projects and
6
+ client permissions; hide the program list when unrestricted execution is selected.
7
+ - Align MCP device discovery with the effective client permissions used by the
8
+ Runner, and explain whether execution or path restrictions come from the
9
+ project configuration or the client authorization.
10
+ - Verify live permission changes and external interpreter execution from working
11
+ directories outside the project without rotating client credentials.
12
+ - Include the HomeAgent icon in MCP server metadata.
13
+
3
14
  ## 0.4.12 — Full-screen interactive Runner
4
15
 
5
16
  - Make `homeagent` the everyday entry point: detect local login automatically,
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.12** supports one administrator and multiple devices.
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.13** supports one administrator and multiple devices.
37
37
 
38
38
  ## Why HomeAgent
39
39
 
@@ -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.12 --depth 1 https://github.com/jhxxr/HomeAgent.git
120
+ git clone --branch v0.4.13 --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.
@@ -368,7 +368,7 @@ helpers. Each package has an explicit file list and license notices.
368
368
  See [release preparation](docs/OPEN_SOURCE.md) to generate a reviewed source
369
369
  archive. Nothing in the release commands automatically publishes or pushes it.
370
370
 
371
- The `v0.4.12` release configuration produces separate `homeagent-server` and
371
+ The `v0.4.13` release configuration produces separate `homeagent-server` and
372
372
  `homeagent-runner` packages; local release commands do not upload to npm or push a
373
373
  GitHub Release. For subsequent releases, increment the version and update the
374
374
  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.12**,支持单管理员、多设备。
36
+ 系统运行无需模型 API Key、第三方中继、遥测或付费云服务;工具结果会返回给你选择的 AI 客户端。当前版本 **v0.4.13**,支持单管理员、多设备。
37
37
 
38
38
  ## 为什么使用 HomeAgent
39
39
 
@@ -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.12 --depth 1 https://github.com/jhxxr/HomeAgent.git
114
+ git clone --branch v0.4.13 --depth 1 https://github.com/jhxxr/HomeAgent.git
115
115
  cd HomeAgent
116
116
 
117
117
  # 用容器生成随机密码和会话密钥,无需在宿主机安装 Node.js
@@ -292,4 +292,4 @@ npm audit --omit=dev --audit-level=high
292
292
 
293
293
  发布前执行 [开源与发布检查](docs/OPEN_SOURCE.md)。npm 发布会生成两个包:`homeagent-server` 只包含 Server/Web Dashboard,`homeagent-runner` 只包含 Runner、共享协议和 Windows 辅助程序;两者都采用明确的发布文件白名单。
294
294
 
295
- `v0.4.12` 的发布配置会分别生成 `homeagent-server` 和 `homeagent-runner`;本地发布命令不会自动上传 npm 或推送 GitHub。后续发布递增版本,更新版本文件和 changelog 后推送匹配标签;预发布使用 npm `next`,正式版本使用 `latest`。Token 权限、OIDC 切换和重试行为见 [自动发布说明](docs/OPEN_SOURCE.md#github-actions-自动发布)。
295
+ `v0.4.13` 的发布配置会分别生成 `homeagent-server` 和 `homeagent-runner`;本地发布命令不会自动上传 npm 或推送 GitHub。后续发布递增版本,更新版本文件和 changelog 后推送匹配标签;预发布使用 npm `next`,正式版本使用 `latest`。Token 权限、OIDC 切换和重试行为见 [自动发布说明](docs/OPEN_SOURCE.md#github-actions-自动发布)。
@@ -1,3 +1,4 @@
1
+ import { effectiveProjectAccess } from '../shared/effective-permissions.js';
1
2
  import path from 'node:path';
2
3
  import { lstat, realpath } from 'node:fs/promises';
3
4
  import { AppError, projectGranted } from '../shared/protocol.js';
@@ -24,8 +25,7 @@ export class Policy {
24
25
  throw new AppError('git_write_disabled', 'Git writes are disabled in the device policy');
25
26
  return {
26
27
  ...project,
27
- filesystemScope: project.filesystemScope === 'device' && principal.machineAccess ? 'device' : 'project',
28
- commandMode: project.commandMode === 'unrestricted' && principal.unrestrictedExecution ? 'unrestricted' : 'allowlist',
28
+ ...effectiveProjectAccess(project, principal),
29
29
  };
30
30
  }
31
31
  /** Reject symlinks/junctions at every component, including existing parents of a new path. */
@@ -36,7 +36,9 @@ export class Policy {
36
36
  throw new AppError('invalid_path', 'Invalid path');
37
37
  const target = path.resolve(project.root, input);
38
38
  if (project.filesystemScope !== 'device' && !inside(project.root, target))
39
- throw new AppError('path_escape', 'Path is outside the project');
39
+ throw new AppError('path_escape', project.filesystemPolicy?.limitedBy === 'authorization'
40
+ ? 'The device project permits device-wide paths, but this client authorization is restricted to the project directory. In Dashboard, enable device-wide absolute paths for the current client authorization. This applies to command working directories too.'
41
+ : 'Path is outside the project. To use an external working directory, enable device-wide paths in both the device project and the current client authorization.');
40
42
  const protectedPaths = [this.config.stateDir, ...(this.config.protectedPaths ?? [])];
41
43
  if (protectedPaths.some(privatePath => inside(privatePath, target)))
42
44
  throw new AppError('private_state', 'Runner configuration and private state are not exposed through file tools');
@@ -78,7 +80,9 @@ export class Policy {
78
80
  command(project, executable) {
79
81
  const equal = (a, b) => process.platform === 'win32' ? a.toLowerCase() === b.toLowerCase() : a === b;
80
82
  if (project.commandMode !== 'unrestricted' && !project.commands.some(command => equal(command, executable)))
81
- throw new AppError('command_denied', 'Executable is not in the project command allowlist; the owner can change execution permissions in the Dashboard');
83
+ throw new AppError('command_denied', project.executionPolicy?.limitedBy === 'authorization'
84
+ ? 'The project permits unrestricted execution, but this client authorization does not. In Dashboard, edit the current client authorization: grant execute scope and unrestricted execution (Full development), or use an explicitly allowed program/alias. Changing the device project alone is insufficient.'
85
+ : 'Executable is not in the project command allowlist. In Dashboard, add the executable or a command alias to the device project, or enable unrestricted execution in both the project and the current client authorization.');
82
86
  // Shells, runtimes and build tools remain powerful if explicitly allowed.
83
87
  if (process.platform === 'win32' && /\.(cmd|bat)$/i.test(executable))
84
88
  throw new AppError('command_denied', 'Use an executable, not a .cmd/.bat wrapper; shell execution is never implicit');
@@ -27,6 +27,8 @@ export class Tools {
27
27
  this.context = new Context(config, this.files, this.git, this.processes);
28
28
  }
29
29
  async invoke(name, input, principal, signal) {
30
+ let executionPolicy;
31
+ let filesystemPolicy;
30
32
  try {
31
33
  if (principal.tools && !principal.tools.includes(name))
32
34
  throw new AppError('tool_forbidden', 'Tool is not enabled for this client authorization');
@@ -34,6 +36,8 @@ export class Tools {
34
36
  throw new AppError('unknown_tool', 'Unknown tool');
35
37
  const tool = name, args = toolSchemas[tool].parse(input);
36
38
  const project = this.policy.project(args.projectId, principal, toolScope(tool), this.deviceId);
39
+ executionPolicy = project.executionPolicy;
40
+ filesystemPolicy = project.filesystemPolicy;
37
41
  const execute = async () => {
38
42
  await this.editor.ready;
39
43
  if (signal?.aborted)
@@ -43,7 +47,7 @@ export class Tools {
43
47
  if (toolScope(tool) !== 'read' && !['recover_edit_transaction', 'save_project_note'].includes(tool))
44
48
  await this.editor.assertWritable(project);
45
49
  switch (tool) {
46
- case 'get_project_context': return { ...await this.context.get(project, principal.id, toolSchemas.get_project_context.parse(args).includeInstructions, signal), grantedScopes: principal.scopes };
50
+ case 'get_project_context': return { ...await this.context.get(project, principal.id, toolSchemas.get_project_context.parse(args).includeInstructions, signal), grantedScopes: principal.scopes, executionPolicy, filesystemPolicy };
47
51
  case 'save_project_note': return this.context.note(project, principal.id, toolSchemas.save_project_note.parse(args).text);
48
52
  case 'read_files': return this.files.readFiles(project, toolSchemas.read_files.parse(args));
49
53
  case 'edit_files': {
@@ -106,7 +110,7 @@ export class Tools {
106
110
  }
107
111
  catch (error) {
108
112
  const code = error instanceof AppError ? error.code : 'tool_failed';
109
- return result({ error: code, message: errorText(error), retryable: ['process_limit', 'git_busy'].includes(code), outcomeUnknown: ['cancelled', 'commit_reconcile_required', 'recovery_required'].includes(code) }, true);
113
+ return result({ error: code, message: errorText(error), ...(code === 'command_denied' && executionPolicy ? { executionPolicy } : {}), ...(code === 'path_escape' && filesystemPolicy ? { filesystemPolicy } : {}), retryable: ['process_limit', 'git_busy'].includes(code), outcomeUnknown: ['cancelled', 'commit_reconcile_required', 'recovery_required'].includes(code) }, true);
110
114
  }
111
115
  }
112
116
  async close() {
@@ -0,0 +1,25 @@
1
+ /** The same intersection is used by discovery and by the Runner at execution. */
2
+ export function effectiveProjectAccess(project, principal) {
3
+ const configuredMode = project.commandMode ?? 'allowlist';
4
+ const unrestrictedExecutionGranted = principal.unrestrictedExecution === true;
5
+ const commandMode = configuredMode === 'unrestricted' && unrestrictedExecutionGranted ? 'unrestricted' : 'allowlist';
6
+ return {
7
+ commandMode,
8
+ filesystemScope: project.filesystemScope === 'device' && principal.machineAccess ? 'device' : 'project',
9
+ filesystemPolicy: {
10
+ configuredScope: project.filesystemScope ?? 'project',
11
+ machineAccessGranted: principal.machineAccess === true,
12
+ limitedBy: project.filesystemScope !== 'device' ? 'project'
13
+ : !principal.machineAccess ? 'authorization' : null,
14
+ },
15
+ executionPolicy: {
16
+ configuredMode, effectiveMode: commandMode,
17
+ unrestrictedExecutionGranted,
18
+ executeScopeGranted: principal.scopes.includes('execute'),
19
+ readOnly: project.readOnly ?? false,
20
+ limitedBy: configuredMode !== 'unrestricted' ? 'project'
21
+ : !unrestrictedExecutionGranted ? 'authorization' : null,
22
+ },
23
+ };
24
+ }
25
+ //# sourceMappingURL=effective-permissions.js.map
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { remotePermissionsSchema } from './permissions.js';
3
- export const VERSION = '0.4.12';
3
+ export const VERSION = '0.4.13';
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'];
@@ -181,7 +181,11 @@ Runner 首次连接时没有项目权限,收到 Server 配置并验证成功
181
181
  - `commandMode=unrestricted`:允许任意可执行文件,实际权限等于 Runner 运行账户;
182
182
  - Git 本地写入、网络 fetch/pull 和 push 三个独立开关。
183
183
 
184
- 客户端授权编辑器另外控制设备、项目、scope、具体工具,以及目录外文件和任意程序两个高级开关。设备上限与客户端授权取交集,因此打开设备级能力不会自动让所有客户端获得该能力。修改已有 PAT 或 OAuth 授权不需要重新复制令牌。
184
+ 客户端授权编辑器另外控制设备、项目、scope、具体工具,以及直接显示的“允许全部程序”和“允许使用设备范围的绝对路径”开关。设备上限与客户端授权取交集,因此打开设备级能力不会自动让所有客户端获得该能力。修改已有 PAT 或 OAuth 授权不需要重新复制令牌。
185
+
186
+ 要运行电脑上其他 Python/Conda 环境,无需逐个填写“允许的程序”:在设备项目的“允许执行的程序”中选择“允许全部程序”,并在当前使用的客户端授权中勾选“允许全部程序”(同时开启执行任务权限)。解释器使用绝对路径,例如 `D:\Conda\envs\eeg\python.exe`;执行参数单独传入 `args`。若工作目录 `cwd` 位于项目外,还需在设备项目选择设备范围的绝对路径,并在当前客户端授权中允许同一能力。“全设备”文件范围不会自动开放全部程序。
187
+
188
+ `list_devices` 和 `get_project_context` 返回当前客户端的有效权限;`executionPolicy`、`filesystemPolicy` 同时说明设备配置与客户端授权。若 `limitedBy=authorization`,应修改当前客户端授权;若为 `project`,应修改设备项目设置。Dashboard 的设备编辑器仍显示设备配置上限。保存设备设置后等待页面显示 Runner 已应用,再发起新的调用。
185
189
 
186
190
  设备和客户端授权都支持临时有效分钟数。到期时 Server 增加 revision、取消在途调用;Runner 会停止该授权启动的托管任务,并恢复上一个永久权限。权限修改使用 `expectedRevision`,浏览器打开过期编辑器时会收到冲突而不会覆盖新设置。保存设备权限会停止此设备的托管任务,已发生的文件修改不会回滚。
187
191
 
@@ -1,6 +1,6 @@
1
1
  # 开源仓库与源码发布
2
2
 
3
- 本仓库以 MIT 开放原始代码,版本为 0.4.12,npm 发布拆成 `homeagent-server` 和 `homeagent-runner` 两个包。Server 包只包含编译后的 Server、Dashboard 和 Server 资源;Runner 包只包含 Runner、共享协议和 Windows 进程树辅助代码。CLI 和源码采用相同许可证;两个 npm 包都通过文件白名单只包含运行所需文件、文档和许可证。包名是否可用及账号发布权限以发布当时的 registry 为准。
3
+ 本仓库以 MIT 开放原始代码,版本为 0.4.13,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.12-source.tar.gz`
56
+ - `HomeAgent-v0.4.13-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.12.tgz`
69
- - `release/homeagent-runner-0.4.12.tgz`
68
+ - `release/homeagent-server-0.4.13.tgz`
69
+ - `release/homeagent-runner-0.4.13.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.12`。
79
+ 1. 推送版本标签,例如 `v0.4.13`。
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.12 -m "HomeAgent v0.4.12"
87
- git push origin v0.4.12
86
+ git tag -a v0.4.13 -m "HomeAgent v0.4.13"
87
+ git push origin v0.4.13
88
88
  ```
89
89
 
90
90
  本文只是发布说明,准备脚本不会替操作者执行这些命令。
91
91
 
92
- 标签必须与 package.json、package-lock.json 及 runtime VERSION 一致,CHANGELOG.md 必须有对应版本的非空条目。预发布可用 `v0.4.12-rc.1`(相关版本文件也必须为 `0.4.12-rc.1`)。禁止把普通分支或不匹配版本伪装成发布。
92
+ 标签必须与 package.json、package-lock.json 及 runtime VERSION 一致,CHANGELOG.md 必须有对应版本的非空条目。预发布可用 `v0.4.13-rc.1`(相关版本文件也必须为 `0.4.13-rc.1`)。禁止把普通分支或不匹配版本伪装成发布。
93
93
 
94
94
  发布流水线按次序执行:
95
95
 
package/docs/TOOLS.md CHANGED
@@ -10,7 +10,7 @@ v0.3 新增的 13 个开发工具、命令别名/环境配置、批量编辑恢
10
10
  | --- | --- | --- |
11
11
  | read | list_directory/read_file/search_files/get_file_info/read_process_output/list_processes/git_status/git_diff/git_log | 项目存在,文件未被排除;进程必须属于当前主体 |
12
12
  | write | write_file/create_directory/move_file/edit_block | readOnly=false |
13
- | execute | start_process/write_process_input/stop_process | readOnly=false;启动时 executable 必须在 commands 内 |
13
+ | execute | start_process/write_process_input/stop_process | readOnly=false;启动时需满足程序名单/别名,或设备项目与客户端均允许全部程序 |
14
14
  | git | git_add/git_commit/git_commit_paths/git_switch_branch/git_fetch/git_pull/git_push | readOnly=false,allowGitWrite=true;网络操作还需对应设备开关 |
15
15
 
16
16
  `readOnly` 禁止所有写入和执行入口;对可写项目的 read token 仍不允许写入。git scope 不自动包含 read。新 OAuth grant 必须选择具体设备/项目,存入 `projectGrants[deviceId]`;新增项目不自动获得访问,刷新保持原范围。PAT 同时支持全局 projects 和设备限定 projectGrants,两者取交集。v0.1 旧 OAuth grant 需撤销重授权才能收紧。
@@ -23,6 +23,8 @@ v0.3 新增的 13 个开发工具、命令别名/环境配置、批量编辑恢
23
23
  2. Dashboard 的客户端编辑器修改既有 PAT/OAuth 授权的设备、项目、scope、工具集合、设备范围文件和任意程序开关。
24
24
  3. 临时设置带有分钟级到期时间。Server 和 Runner 都独立检查过期;在途调用和对应长任务会被停止,随后恢复永久权限。
25
25
 
26
+ `list_devices` 的项目 `commandMode` / `filesystemScope` 与 `get_project_context` 的项目字段均为当前客户端的有效策略。两者的 `executionPolicy` 提供 `configuredMode`、`effectiveMode`、`unrestrictedExecutionGranted`、`executeScopeGranted`、`readOnly` 和 `limitedBy`;`filesystemPolicy` 提供 `configuredScope`、`machineAccessGranted` 和 `limitedBy`。`limitedBy=project` 表示设备项目未开放对应能力,`authorization` 表示设备已开放但当前客户端未获授权,`null` 表示该能力两层均已开放;执行仍需满足 scope、工具集合和非只读等条件。`command_denied` / `path_escape` 错误也附带相应策略和修改位置。
27
+
26
28
  设备项目目录、权限、命令别名和环境配置统一保存在 Server 上。本地不接受项目配置或权限开关;未收到并成功应用 Server 设置前,没有项目访问权限。断线、清空项目或配置应用失败均收回项目权限。stateDir 仍是被控端本机的凭据与任务目录。homeagent check-config 只检查本机连接设置,终端同步后显示实际应用目录。
27
29
 
28
30
  ## 文件工具
@@ -40,7 +42,7 @@ v0.3 新增的 13 个开发工具、命令别名/环境配置、批量编辑恢
40
42
 
41
43
  ## 终端工具
42
44
 
43
- `start_process(executable,args=[],cwd=".",timeoutMs=3600000)` 直接 spawn,不拼接 shell;超时范围 100 ms 到 24 小时。默认本机 commands 为空,必须显式允许。可执行文件匹配完整字符串,Windows 忽略大小写;推荐绝对路径,避免 PATH 劫持。Windows .cmd/.bat 不会隐式启动 shell,直接拒绝;要执行 shell 必须显式允许 shell 可执行文件并承担其完整权限。
45
+ `start_process(executable,args=[],cwd=".",timeoutMs=3600000)` 直接 spawn,不拼接 shell;超时范围 100 ms 到 24 小时。默认 commands 为空;可在 Dashboard 添加指定程序,或在设备项目与当前客户端授权中开启“允许全部程序”。指定程序匹配完整字符串,Windows 忽略大小写;推荐绝对路径,避免 PATH 劫持。解释器可位于项目外;项目外的 `cwd` 还需设备与客户端均允许设备范围路径。Windows .cmd/.bat 不会隐式启动 shell,直接拒绝;要执行 shell 必须允许 shell 可执行文件并承担其完整权限。
44
46
 
45
47
  可选 `idempotencyKey`(8–128 字符)应由调用方生成并在不确定响应重试时保持不变。相同主体/项目/key 和相同 executable/args/规范化 cwd/timeout 返回原任务;冲突参数拒绝。准入先写 SQLite,再 spawn。48 小时内保留收据,已清理任务不会因此重跑;key 过期或换 key 后不再去重。不是所有文件/Git 操作的 exactly-once 保证。
46
48
 
package/package.json CHANGED
@@ -43,5 +43,5 @@
43
43
  "ws": "8.22.0",
44
44
  "zod": "4.6.7"
45
45
  },
46
- "version": "0.4.12"
46
+ "version": "0.4.13"
47
47
  }