homeagent-runner 0.4.18 → 0.4.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,22 +1,26 @@
1
- # 开源仓库与源码发布
1
+ # Open Source Repository and Source Releases
2
2
 
3
- 本仓库以 MIT 开放原始代码,版本为 0.4.18,npm 发布拆成 `homeagent-server` 和 `homeagent-runner` 两个包。Server 包只包含编译后的 Server、Dashboard 和 Server 资源;Runner 包只包含 Runner、共享协议和 Windows 进程树辅助代码。CLI 和源码采用相同许可证;两个 npm 包都通过文件白名单只包含运行所需文件、文档和许可证。包名是否可用及账号发布权限以发布当时的 registry 为准。
3
+ **English** · [简体中文](OPEN_SOURCE.zh-CN.md)
4
4
 
5
- ## 文件划分
5
+ This repository releases its original source under the MIT License at version 0.4.20; the npm release is split into two packages, `homeagent-server` and `homeagent-runner`. The Server package contains only the compiled Server, Dashboard and Server assets; the Runner package contains only the Runner, the shared protocol and the Windows process-tree helper. The CLI and source share the same license; both npm packages use file allowlists to include only files needed at runtime, documentation and licenses. Package-name availability and account publish permissions are as determined by the registry at release time.
6
6
 
7
- | 路径 | 内容 |
7
+ ## File Layout
8
+
9
+ | Path | Contents |
8
10
  | --- | --- |
9
- | bin/、src/、public/、runtime/ | CLI、Server、Runner、Dashboard 和 Windows 进程树辅助代码 |
10
- | tests/ | 临时目录内运行的工具、安全、协议和 Node/Python 场景测试 |
11
- | deploy/、Dockerfile、compose.yaml | 自托管部署文件 |
12
- | scripts/ | 配置初始化、备份、许可证生成、源码清点和发布检查 |
13
- | docs/ | 部署、协议、工具、开发流程、源码对比及验证边界 |
14
- | licenses/、THIRD_PARTY_NOTICES.md | 锁定的生产依赖许可证与声明 |
15
- | .github/ | CI、自动 Release、问题/PR 模板和依赖更新配置 |
11
+ | bin/, src/, public/, runtime/ | CLI, Server, Runner, Dashboard and Windows process-tree helper code |
12
+ | tests/ | Tool, security, protocol and Node/Python scenario tests running in temp directories |
13
+ | deploy/, Dockerfile, compose.yaml | Self-hosted deployment files |
14
+ | scripts/ | Config initialization, backup, license generation, source inventory and release checks |
15
+ | docs/ | Deployment, protocol, tools, development workflow, source comparison and validation boundaries |
16
+ | licenses/, THIRD_PARTY_NOTICES.md | Locked production dependency licenses and notices |
17
+ | .github/ | CI, automatic Release, issue/PR templates and dependency update config |
18
+
19
+ Every guide under `docs/` is shipped in two languages: the unsuffixed file is the canonical English guide and the `.zh-CN.md` file is the aligned Simplified Chinese translation. Both are part of the release, so the source archive and npm packages include both language versions; the root README also ships as `README.md` and `README.zh-CN.md`.
16
20
 
17
- `.env.example` 是 Server 配置模板;Runner 连接设置由 `homeagent` 的交互界面生成。真实 `.env`、Runner 配置、设备凭据、数据库、编辑备份、日志、参考源码 checkout、node_modules 和构建目录均不能加入发布内容。
21
+ `.env.example` is the Server config template; Runner connection settings are generated by the `homeagent` interactive UI. Real `.env`, Runner config, device credentials, databases, edit backups, logs, reference source checkouts, `node_modules` and build directories must never enter a release.
18
22
 
19
- ## 本地准备
23
+ ## Local Preparation
20
24
 
21
25
  ```sh
22
26
  npm ci
@@ -27,13 +31,13 @@ npm run release:npm
27
31
  npm run test:package
28
32
  ```
29
33
 
30
- `npm run release:check` 检查 Git 跟踪文件和未忽略的新文件,验证敏感凭据模式、禁止的运行目录、许可证/版本一致性及本地 Markdown 链接。提交前可以使用 `node scripts/check-release.mjs --staged`,检查暂存区实际内容。它不会打印命中的秘密正文。
34
+ `npm run release:check` inspects Git-tracked files and unignored new files, validating sensitive credential patterns, forbidden runtime directories, license/version consistency and local Markdown links. Before committing, use `node scripts/check-release.mjs --staged` to inspect the actual staged content. It never prints the matched secret text.
31
35
 
32
- 图片仅允许 `public/icon.png` 和 `docs/screenshots/` 下的 `dashboard.png`、`dashboard-mobile.png`、`permissions.png`、`jobs.png`、`runner-tui.png`;检查 PNG 文件头,并限制每张不超过 2 MiB、每边不超过 4096 像素。图片内容需人工查看,截图应来自隔离演示环境,不得包含真实凭据或私人项目数据。Runner 包仅携带 README 使用的图标,不包含 Dashboard 脚本。
36
+ Only these images are allowed: `public/icon.png` and `docs/screenshots/dashboard.png`, `dashboard-mobile.png`, `permissions.png`, `jobs.png`, `runner-tui.png`; PNG headers are checked and each image is limited to 2 MiB and 4096 pixels per side. Image content still needs human review; screenshots should come from an isolated demo environment and contain no real credentials or private project data. The Runner package carries only the icon used by the README, not the Dashboard scripts.
33
37
 
34
- 这些只是可复现的自动检查,不能证明没有未知类型的敏感数据。公开前仍需人工检查文件列表、部署示例和私有路径。不要用“把整个工作目录压缩”代替源码发布。
38
+ These are reproducible automated checks only; they cannot prove the absence of unknown kinds of sensitive data. Before publishing, still manually review the file list, deployment examples and private paths. Do not substitute "zip the whole working directory" for a source release.
35
39
 
36
- 更新生产依赖后:
40
+ After updating production dependencies:
37
41
 
38
42
  ```sh
39
43
  npm ci
@@ -41,89 +45,89 @@ npm run notices
41
45
  npm run notices:check
42
46
  ```
43
47
 
44
- 提交 package-lock.json 与 licenses/npm-runtime.txt,保留原依赖条款。发布脚本和 CI 不执行参考仓库代码。
48
+ Commit `package-lock.json` and `licenses/npm-runtime.txt`, preserving the original dependency terms. Release scripts and CI do not execute reference repository code.
45
49
 
46
- ## 生成干净源码包
50
+ ## Generating a Clean Source Archive
47
51
 
48
- 将准备好的文件提交到 Git,工作区保持干净:
52
+ Commit the prepared files to Git and keep the working tree clean:
49
53
 
50
54
  ```sh
51
55
  npm run release:source
52
56
  ```
53
57
 
54
- 输出位于被忽略的 release/:
58
+ Output goes to the ignored `release/`:
55
59
 
56
- - `HomeAgent-v0.4.18-source.tar.gz`
57
- - 对应 `.sha256` 校验文件
58
- - 对应 `.manifest.txt`,包括版本、Git 提交和全部发布路径
60
+ - `HomeAgent-v0.4.20-source.tar.gz`
61
+ - the corresponding `.sha256` checksum file
62
+ - the corresponding `.manifest.txt`, including version, Git commit and all release paths
59
63
 
60
- 归档只从 HEAD 生成,不包含 `.git` 历史、Git 作者配置、忽略文件、数据库、临时凭据或 node_modules。运行命令不会创建远程仓库、push、打标签、上传 Release 或发布 npm。
64
+ The archive is generated only from HEAD and contains no `.git` history, Git author config, ignored files, databases, temporary credentials or `node_modules`. Running the command does not create a remote repository, push, tag, upload a Release or publish to npm.
61
65
 
62
- 重建前的旧 Git/运行数据如果被保存在仓库外私有备份中,不要上传该目录;它不是项目源码的一部分。历史验证文档不再引用那些仅存在于旧本地历史的提交号。
66
+ If old Git/runtime data from before the rebuild was kept in a private backup outside the repository, do not upload that directory; it is not part of the project source. Historical validation documents no longer reference commit IDs that exist only in old local history.
63
67
 
64
- ## npm 安装包检查
68
+ ## npm Package Checks
65
69
 
66
- `npm run release:npm` 构建 JavaScript、以 `--ignore-scripts` 分别打包两个包,并检查归档文件白名单、运行资源及 SHA-512 完整性,输出:
70
+ `npm run release:npm` builds the JavaScript, packs the two packages separately with `--ignore-scripts`, checks archive file allowlists, runtime assets and SHA-512 integrity, and outputs:
67
71
 
68
- - `release/homeagent-server-0.4.18.tgz`
69
- - `release/homeagent-runner-0.4.18.tgz`
70
- - 两个归档各自的 `.sha256`
71
- - `release/npm-packages.json`:两个包的名称、版本、Git commit、校验、dist-tag 和路径清单
72
+ - `release/homeagent-server-0.4.20.tgz`
73
+ - `release/homeagent-runner-0.4.20.tgz`
74
+ - a `.sha256` for each archive
75
+ - `release/npm-packages.json`: both packages' names, versions, Git commit, checksum, dist-tag and path lists
72
76
 
73
- `npm run test:package` 把两个归档分别全局安装到隔离的临时 prefix,验证 `homeagent-server` 和 `homeagent` 两个真实命令 shim、帮助/版本、Server 配置初始化及拒绝覆盖、Runner 配置,以及从已安装包启动 Server、加载 Dashboard 静态文件、Runner 登录和 `/mcp` 认证。Linux 和 Windows CI 都执行该检查。没有上传到 npm,也不修改用户已有全局安装。
77
+ `npm run test:package` installs both archives globally into isolated temp prefixes, verifying the real `homeagent-server` and `homeagent` command shims, help/version, Server config initialization and overwrite refusal, Runner config, plus starting the Server from the installed package, loading Dashboard static assets, Runner login and `/mcp` authentication. Linux and Windows CI both run this check. Nothing is uploaded to npm and the user's existing global installs are not modified.
74
78
 
75
- ## GitHub Actions 自动发布
79
+ ## Automated Release via GitHub Actions
76
80
 
77
- `.github/workflows/release.yml` 支持两种入口:
81
+ `.github/workflows/release.yml` supports two entry points:
78
82
 
79
- 1. 推送版本标签,例如 `v0.4.18`。
80
- 2. 在 Actions → release → Run workflow 中填写**已经存在**的版本标签。
83
+ 1. Push a version tag, for example `v0.4.20`.
84
+ 2. In Actions → release → Run workflow, enter an **already existing** version tag.
81
85
 
82
- 先按下一节配置 `NPM_TOKEN`。首次推送源码、配置真实 `origin` 并确认 Actions 可用后,可以按下面方式发布:
86
+ Configure `NPM_TOKEN` as described in the next section. After the initial source push, configuring the real `origin` and confirming Actions are available, you can publish as follows:
83
87
 
84
88
  ```sh
85
- # 先提交本次版本的源码和文档,工作区保持干净
86
- git tag -a v0.4.18 -m "HomeAgent v0.4.18"
87
- git push origin v0.4.18
89
+ # First commit this version's source and docs, keeping the working tree clean
90
+ git tag -a v0.4.20 -m "HomeAgent v0.4.20"
91
+ git push origin v0.4.20
88
92
  ```
89
93
 
90
- 本文只是发布说明,准备脚本不会替操作者执行这些命令。
94
+ This document is release documentation only; the preparation scripts do not execute these commands for the operator.
91
95
 
92
- 标签必须与 package.json、package-lock.json 及 runtime VERSION 一致,CHANGELOG.md 必须有对应版本的非空条目。预发布可用 `v0.4.18-rc.1`(相关版本文件也必须为 `0.4.18-rc.1`)。禁止把普通分支或不匹配版本伪装成发布。
96
+ The tag must match `package.json`, `package-lock.json` and the runtime VERSION, and `CHANGELOG.md` must have a non-empty entry for that version. A prerelease may use `v0.4.20-rc.1` (all related version files must then be `0.4.20-rc.1`). Do not disguise an ordinary branch or a mismatched version as a release.
93
97
 
94
- 发布流水线按次序执行:
98
+ The release pipeline runs in order:
95
99
 
96
- - 校验实际标签、所指 commit、版本与 changelog。
97
- - 使用同一准确 commit 调用复用 CI,执行 Linux/Windows 测试、安装包实测、许可证/发布检查和 Docker Compose 健康验证。CI 明确安装 Python,不依赖 runner 镜像恰巧预装解释器。
98
- - 通过 Git archive 生成源码 tar.gz;构建并检查两个 npm tgz,生成三者的校验和清单;发布说明取自当前版本 changelog。
99
- - 发布 npm job 下载已经验证的两个归档,分别核对 commit、包名、版本、dist-tag、校验及远程标签,使用 Secret 或 OIDC 发布。它不 checkout、不安装依赖,`npm publish --ignore-scripts` 不执行包生命周期脚本。Secret 只传给该发布步骤。
100
- - npm 成功后,GitHub Release job 才获得 contents:write。该 job 不 checkout 源码、不 npm install、不执行项目代码;再次检查远程标签,先创建 draft、上传源码包与 npm 包及元数据,最后公开。
100
+ - Validate the actual tag, its target commit, version and changelog.
101
+ - Call the reusable CI at that exact commit, running Linux/Windows tests, installed-package smoke tests, license/release checks and Docker Compose health verification. CI installs Python explicitly rather than relying on an interpreter happening to be preinstalled in the runner image.
102
+ - Generate the source tar.gz via Git archive; build and check both npm tgz files; generate checksums and manifests for all three; take release notes from the current version's changelog.
103
+ - The npm publish job downloads the already-verified archives, re-checks commit, package name, version, dist-tag, checksum and remote tag for each, and publishes using a Secret or OIDC. It does not checkout, does not install dependencies, and `npm publish --ignore-scripts` runs no package lifecycle scripts. The Secret is passed only to that publish step.
104
+ - Only after npm succeeds does the GitHub Release job receive `contents:write`. That job does not checkout source, run `npm install` or execute project code; it re-checks the remote tag, creates a draft, uploads the source archive, npm packages and metadata, and finally publishes.
101
105
 
102
- GitHub Release 使用自动提供的 GITHUB_TOKEN,不需要 GitHub PAT。npm 默认使用下述 NPM_TOKEN,或配置 OIDC。组织/仓库策略必须允许 Release job 写入;请保护版本标签的创建权限。预发布标签自动标为 GitHub prerelease,并使用 npm `next`,避免替换正式版 `latest`。
106
+ The GitHub Release uses the automatically provided `GITHUB_TOKEN`; no GitHub PAT is needed. npm uses the `NPM_TOKEN` described below by default, or OIDC can be configured. Organization/repository policy must allow the Release job to write; protect permission to create version tags. Prerelease tags are automatically marked as GitHub prereleases and use the npm `next` tag, avoiding replacement of the stable `latest`.
103
107
 
104
- 已经公开的同标签 GitHub Release 不会被覆盖。上传中断时保留 draft,可以对同标签重新运行并补齐资产。若 npm 已成功而 GitHub Release 失败,重试时只在 registry 中该版本的 SHA-512 integrity 与验证包完全一致时跳过重复 npm 发布;不一致则失败。网络错误不会被当成版本不存在。npm 版本不可覆盖,修复后应递增版本,不移动旧标签。
108
+ An already published GitHub Release for the same tag is never overwritten. If an upload is interrupted, the draft is retained and a rerun for the same tag can complete the assets. If npm succeeded but the GitHub Release failed, a retry skips duplicate npm publishing only when the SHA-512 integrity of that version in the registry exactly matches the verified package; otherwise it fails. Network errors are not treated as "version does not exist". npm versions cannot be overwritten; fix by incrementing the version, never by moving an old tag.
105
109
 
106
- 当前发布源码和 npm CLI,不上传 Docker registry,也不产出独立 EXE。GitHub 工作流只有在仓库被推送到 GitHub 并触发后才会实际运行;本地准备不会替代真实 Actions 验收。
110
+ The current release ships source and the npm CLI; it does not upload a Docker registry image or produce standalone EXEs. GitHub workflows only actually run after the repository has been pushed to GitHub and triggered; local preparation does not replace real Actions verification.
107
111
 
108
- ## 配置 NPM_TOKEN
112
+ ## Configuring NPM_TOKEN
109
113
 
110
- 1. 使用自己的 npm 账号登录 npm 网站,开启 2FA,创建 **granular access token**。
111
- 2. 授予目标包的 **Read and write** 发布权限,并启用 **Bypass 2FA**。只有 stage-only 权限的 Token 不能执行本工作流的直接 `npm publish`。首次创建包时,确保 Token 允许创建该包;只授权另一个已有包不会取得新包权限。首次发布后建议缩小到目标包,设置合适的有效期并按期轮换。不要使用已停用的 classic Token。
112
- 3. GitHub 仓库 → Settings → Secrets and variables → Actions → New repository secret,名称填写 **`NPM_TOKEN`**,值粘贴 npm Token。不是 Variables,也不是 GitHub PAT。
113
- 4. 保持 `NPM_AUTH_MODE` 未设置(默认 Token),再推送版本标签。仅添加 Secret 不会触发发布。
114
+ 1. Log in to the npm website with your own account, enable 2FA and create a **granular access token**.
115
+ 2. Grant **Read and write** publish permission for the target packages and enable **Bypass 2FA**. A stage-only token cannot perform this workflow's direct `npm publish`. When creating a package for the first time, ensure the token allows creating it; authorizing only another existing package does not grant permission for a new one. After the first publish, narrow it to the target packages, set a sensible expiry and rotate on schedule. Do not use a disabled classic Token.
116
+ 3. In the GitHub repository → Settings → Secrets and variables → Actions → New repository secret, set the name to **`NPM_TOKEN`** and paste the npm Token value. It is not a Variable and not a GitHub PAT.
117
+ 4. Leave `NPM_AUTH_MODE` unset (default Token), then push the version tag. Adding the Secret alone does not trigger a release.
114
118
 
115
- 没有把 Token 放入 `.npmrc`、仓库文件或命令输出。首次发布会创建两个公开包;若任一包名已被占用,需先修改对应 manifest 和文档,或改用自己有权限的 npm scope。
119
+ The Token is never placed in `.npmrc`, repository files or command output. The first publish creates two public packages; if either name is taken, first change the corresponding manifest and docs, or use an npm scope you control.
116
120
 
117
- **平台规则日期:2026-10-26。** npm 官方已宣布 **2027 年 1 月** 移除 granular Token 直接发布新版本的能力。当前 Token 路径仅适用于仍允许直接发布的阶段;应提前迁移到以下 OIDC 方案,不能把长期自动发布建立在固定 Token 上。以 npm 官方的 access tokens / trusted publishers 文档和账号实际设置为准。
121
+ **Platform rule date: 2026-10-26.** npm has announced that granular Tokens will lose the ability to directly publish new versions in **January 2027**. The current Token path applies only while direct publishing is still allowed; migrate to the OIDC approach below in advance and do not build long-term automated releasing on a fixed Token. Follow npm's official access tokens / trusted publishers documentation and your account's actual settings.
118
122
 
119
- ## 切换 npm OIDC trusted publishing
123
+ ## Switching to npm OIDC Trusted Publishing
120
124
 
121
- 包已存在后,在 npm 包设置中添加 GitHub Actions trusted publisher:仓库 owner/repository 必须与实际公开仓库一致,workflow 文件名为 **`release.yml`**,未配置 GitHub Environment 时留空该项。然后在 GitHub Repository Variables 添加 **`NPM_AUTH_MODE=oidc`**。
125
+ Once the packages exist, add a GitHub Actions trusted publisher in the npm package settings: owner/repository must match the actual public repository, the workflow filename is **`release.yml`**, and leave the GitHub Environment field empty when none is configured. Then add the GitHub Repository Variable **`NPM_AUTH_MODE=oidc`**.
122
126
 
123
- 工作流已给 npm job 设置 `id-token: write`,使用 npm OIDC/provenance,且会移除 Token userconfig;该路径不读取 `NPM_TOKEN`。切换成功后可删除旧 Secret 并撤销 Token。首次创建包和账号身份验证可能仍需要按 npm 当时要求在本人设备上交互操作。
127
+ The workflow already grants the npm job `id-token: write`, uses npm OIDC/provenance and removes the Token userconfig; this path does not read `NPM_TOKEN`. After a successful switch you can delete the old Secret and revoke the Token. First-time package creation and account identity verification may still require interactive steps on your own device, as npm requires at the time.
124
128
 
125
- ## 选择托管平台后
129
+ ## After Choosing a Hosting Platform
126
130
 
127
- 由仓库所有者创建公开仓库、配置真实远程地址和维护者联系渠道,启用私有安全报告并检查 Actions 权限。项目不自动填入无法验证的远程地址,也不自动设置分支保护或向外部人员发送消息。
131
+ The repository owner creates the public repository, configures the real remote and maintainer contact channel, enables private security reporting and checks Actions permissions. The project does not auto-fill unverifiable remote addresses, auto-configure branch protection or send messages to external parties.
128
132
 
129
- 首次推送后观察 Linux、Windows、Docker CI 的实际结果。当前本地验证记录不能冒充该公开仓库已经跑过的 CI。正式使用前完成自己的 HTTPS、备份恢复和系统重启验收。
133
+ After the first push, observe the actual Linux, Windows and Docker CI results. The current local validation record must not be presented as CI already run on that public repository. Before production use, complete your own HTTPS, backup/restore and system reboot acceptance.
@@ -0,0 +1,133 @@
1
+ # 开源仓库与源码发布
2
+
3
+ [English](OPEN_SOURCE.md) · **简体中文**
4
+
5
+ 本仓库以 MIT 开放原始代码,版本为 0.4.20,npm 发布拆成 `homeagent-server` 和 `homeagent-runner` 两个包。Server 包只包含编译后的 Server、Dashboard 和 Server 资源;Runner 包只包含 Runner、共享协议和 Windows 进程树辅助代码。CLI 和源码采用相同许可证;两个 npm 包都通过文件白名单只包含运行所需文件、文档和许可证。包名是否可用及账号发布权限以发布当时的 registry 为准。
6
+
7
+ ## 文件划分
8
+
9
+ | 路径 | 内容 |
10
+ | --- | --- |
11
+ | bin/、src/、public/、runtime/ | CLI、Server、Runner、Dashboard 和 Windows 进程树辅助代码 |
12
+ | tests/ | 临时目录内运行的工具、安全、协议和 Node/Python 场景测试 |
13
+ | deploy/、Dockerfile、compose.yaml | 自托管部署文件 |
14
+ | scripts/ | 配置初始化、备份、许可证生成、源码清点和发布检查 |
15
+ | docs/ | 部署、协议、工具、开发流程、源码对比及验证边界 |
16
+ | licenses/、THIRD_PARTY_NOTICES.md | 锁定的生产依赖许可证与声明 |
17
+ | .github/ | CI、自动 Release、问题/PR 模板和依赖更新配置 |
18
+
19
+ `docs/` 下每篇指南都提供两种语言:无后缀文件是英文规范版,`.zh-CN.md` 是内容对齐的简体中文版。两者都属于发布内容,因此源码归档和 npm 包都包含双语版本;根目录 README 同样以 `README.md` 与 `README.zh-CN.md` 双文件发布。
20
+
21
+ `.env.example` 是 Server 配置模板;Runner 连接设置由 `homeagent` 的交互界面生成。真实 `.env`、Runner 配置、设备凭据、数据库、编辑备份、日志、参考源码 checkout、node_modules 和构建目录均不能加入发布内容。
22
+
23
+ ## 本地准备
24
+
25
+ ```sh
26
+ npm ci
27
+ npm run verify
28
+ npm run notices:check
29
+ npm audit --omit=dev --audit-level=high
30
+ npm run release:npm
31
+ npm run test:package
32
+ ```
33
+
34
+ `npm run release:check` 检查 Git 跟踪文件和未忽略的新文件,验证敏感凭据模式、禁止的运行目录、许可证/版本一致性及本地 Markdown 链接。提交前可以使用 `node scripts/check-release.mjs --staged`,检查暂存区实际内容。它不会打印命中的秘密正文。
35
+
36
+ 图片仅允许 `public/icon.png` 和 `docs/screenshots/` 下的 `dashboard.png`、`dashboard-mobile.png`、`permissions.png`、`jobs.png`、`runner-tui.png`;检查 PNG 文件头,并限制每张不超过 2 MiB、每边不超过 4096 像素。图片内容需人工查看,截图应来自隔离演示环境,不得包含真实凭据或私人项目数据。Runner 包仅携带 README 使用的图标,不包含 Dashboard 脚本。
37
+
38
+ 这些只是可复现的自动检查,不能证明没有未知类型的敏感数据。公开前仍需人工检查文件列表、部署示例和私有路径。不要用"把整个工作目录压缩"代替源码发布。
39
+
40
+ 更新生产依赖后:
41
+
42
+ ```sh
43
+ npm ci
44
+ npm run notices
45
+ npm run notices:check
46
+ ```
47
+
48
+ 提交 package-lock.json 与 licenses/npm-runtime.txt,保留原依赖条款。发布脚本和 CI 不执行参考仓库代码。
49
+
50
+ ## 生成干净源码包
51
+
52
+ 将准备好的文件提交到 Git,工作区保持干净:
53
+
54
+ ```sh
55
+ npm run release:source
56
+ ```
57
+
58
+ 输出位于被忽略的 release/:
59
+
60
+ - `HomeAgent-v0.4.20-source.tar.gz`
61
+ - 对应 `.sha256` 校验文件
62
+ - 对应 `.manifest.txt`,包括版本、Git 提交和全部发布路径
63
+
64
+ 归档只从 HEAD 生成,不包含 `.git` 历史、Git 作者配置、忽略文件、数据库、临时凭据或 node_modules。运行命令不会创建远程仓库、push、打标签、上传 Release 或发布 npm。
65
+
66
+ 重建前的旧 Git/运行数据如果被保存在仓库外私有备份中,不要上传该目录;它不是项目源码的一部分。历史验证文档不再引用那些仅存在于旧本地历史的提交号。
67
+
68
+ ## npm 安装包检查
69
+
70
+ `npm run release:npm` 构建 JavaScript、以 `--ignore-scripts` 分别打包两个包,并检查归档文件白名单、运行资源及 SHA-512 完整性,输出:
71
+
72
+ - `release/homeagent-server-0.4.20.tgz`
73
+ - `release/homeagent-runner-0.4.20.tgz`
74
+ - 两个归档各自的 `.sha256`
75
+ - `release/npm-packages.json`:两个包的名称、版本、Git commit、校验、dist-tag 和路径清单
76
+
77
+ `npm run test:package` 把两个归档分别全局安装到隔离的临时 prefix,验证 `homeagent-server` 和 `homeagent` 两个真实命令 shim、帮助/版本、Server 配置初始化及拒绝覆盖、Runner 配置,以及从已安装包启动 Server、加载 Dashboard 静态文件、Runner 登录和 `/mcp` 认证。Linux 和 Windows CI 都执行该检查。没有上传到 npm,也不修改用户已有全局安装。
78
+
79
+ ## GitHub Actions 自动发布
80
+
81
+ `.github/workflows/release.yml` 支持两种入口:
82
+
83
+ 1. 推送版本标签,例如 `v0.4.20`。
84
+ 2. 在 Actions → release → Run workflow 中填写**已经存在**的版本标签。
85
+
86
+ 先按下一节配置 `NPM_TOKEN`。首次推送源码、配置真实 `origin` 并确认 Actions 可用后,可以按下面方式发布:
87
+
88
+ ```sh
89
+ # 先提交本次版本的源码和文档,工作区保持干净
90
+ git tag -a v0.4.20 -m "HomeAgent v0.4.20"
91
+ git push origin v0.4.20
92
+ ```
93
+
94
+ 本文只是发布说明,准备脚本不会替操作者执行这些命令。
95
+
96
+ 标签必须与 package.json、package-lock.json 及 runtime VERSION 一致,CHANGELOG.md 必须有对应版本的非空条目。预发布可用 `v0.4.20-rc.1`(相关版本文件也必须为 `0.4.20-rc.1`)。禁止把普通分支或不匹配版本伪装成发布。
97
+
98
+ 发布流水线按次序执行:
99
+
100
+ - 校验实际标签、所指 commit、版本与 changelog。
101
+ - 使用同一准确 commit 调用复用 CI,执行 Linux/Windows 测试、安装包实测、许可证/发布检查和 Docker Compose 健康验证。CI 明确安装 Python,不依赖 runner 镜像恰巧预装解释器。
102
+ - 通过 Git archive 生成源码 tar.gz;构建并检查两个 npm tgz,生成三者的校验和清单;发布说明取自当前版本 changelog。
103
+ - 发布 npm job 下载已经验证的两个归档,分别核对 commit、包名、版本、dist-tag、校验及远程标签,使用 Secret 或 OIDC 发布。它不 checkout、不安装依赖,`npm publish --ignore-scripts` 不执行包生命周期脚本。Secret 只传给该发布步骤。
104
+ - npm 成功后,GitHub Release job 才获得 contents:write。该 job 不 checkout 源码、不 npm install、不执行项目代码;再次检查远程标签,先创建 draft、上传源码包与 npm 包及元数据,最后公开。
105
+
106
+ GitHub Release 使用自动提供的 GITHUB_TOKEN,不需要 GitHub PAT。npm 默认使用下述 NPM_TOKEN,或配置 OIDC。组织/仓库策略必须允许 Release job 写入;请保护版本标签的创建权限。预发布标签自动标为 GitHub prerelease,并使用 npm `next`,避免替换正式版 `latest`。
107
+
108
+ 已经公开的同标签 GitHub Release 不会被覆盖。上传中断时保留 draft,可以对同标签重新运行并补齐资产。若 npm 已成功而 GitHub Release 失败,重试时只在 registry 中该版本的 SHA-512 integrity 与验证包完全一致时跳过重复 npm 发布;不一致则失败。网络错误不会被当成版本不存在。npm 版本不可覆盖,修复后应递增版本,不移动旧标签。
109
+
110
+ 当前发布源码和 npm CLI,不上传 Docker registry,也不产出独立 EXE。GitHub 工作流只有在仓库被推送到 GitHub 并触发后才会实际运行;本地准备不会替代真实 Actions 验收。
111
+
112
+ ## 配置 NPM_TOKEN
113
+
114
+ 1. 使用自己的 npm 账号登录 npm 网站,开启 2FA,创建 **granular access token**。
115
+ 2. 授予目标包的 **Read and write** 发布权限,并启用 **Bypass 2FA**。只有 stage-only 权限的 Token 不能执行本工作流的直接 `npm publish`。首次创建包时,确保 Token 允许创建该包;只授权另一个已有包不会取得新包权限。首次发布后建议缩小到目标包,设置合适的有效期并按期轮换。不要使用已停用的 classic Token。
116
+ 3. GitHub 仓库 → Settings → Secrets and variables → Actions → New repository secret,名称填写 **`NPM_TOKEN`**,值粘贴 npm Token。不是 Variables,也不是 GitHub PAT。
117
+ 4. 保持 `NPM_AUTH_MODE` 未设置(默认 Token),再推送版本标签。仅添加 Secret 不会触发发布。
118
+
119
+ 没有把 Token 放入 `.npmrc`、仓库文件或命令输出。首次发布会创建两个公开包;若任一包名已被占用,需先修改对应 manifest 和文档,或改用自己有权限的 npm scope。
120
+
121
+ **平台规则日期:2026-10-26。** npm 官方已宣布 **2027 年 1 月** 移除 granular Token 直接发布新版本的能力。当前 Token 路径仅适用于仍允许直接发布的阶段;应提前迁移到以下 OIDC 方案,不能把长期自动发布建立在固定 Token 上。以 npm 官方的 access tokens / trusted publishers 文档和账号实际设置为准。
122
+
123
+ ## 切换 npm OIDC trusted publishing
124
+
125
+ 包已存在后,在 npm 包设置中添加 GitHub Actions trusted publisher:仓库 owner/repository 必须与实际公开仓库一致,workflow 文件名为 **`release.yml`**,未配置 GitHub Environment 时留空该项。然后在 GitHub Repository Variables 添加 **`NPM_AUTH_MODE=oidc`**。
126
+
127
+ 工作流已给 npm job 设置 `id-token: write`,使用 npm OIDC/provenance,且会移除 Token userconfig;该路径不读取 `NPM_TOKEN`。切换成功后可删除旧 Secret 并撤销 Token。首次创建包和账号身份验证可能仍需要按 npm 当时要求在本人设备上交互操作。
128
+
129
+ ## 选择托管平台后
130
+
131
+ 由仓库所有者创建公开仓库、配置真实远程地址和维护者联系渠道,启用私有安全报告并检查 Actions 权限。项目不自动填入无法验证的远程地址,也不自动设置分支保护或向外部人员发送消息。
132
+
133
+ 首次推送后观察 Linux、Windows、Docker CI 的实际结果。当前本地验证记录不能冒充该公开仓库已经跑过的 CI。正式使用前完成自己的 HTTPS、备份恢复和系统重启验收。
package/docs/README.md CHANGED
@@ -1,27 +1,31 @@
1
- # 文档索引
1
+ # Documentation Index
2
2
 
3
- ## 使用
3
+ **English** · [简体中文](README.zh-CN.md)
4
4
 
5
- - [部署、配对与运维](DEPLOYMENT.md):原生/Compose、HTTPS、反代、Runner、自启动、备份。
6
- - [AI 客户端接入](CLIENTS.md):OAuth/PAT、协议与调用方式。
7
- - [日常开发流程](DEVELOPMENT_WORKFLOW.md):命令环境、按行读取、多文件编辑、日志、安全提交与接续。
8
- - [远程协助](REMOTE_ASSIST.md):邀请朋友、本机临时批准、独立到期与立即停止。
9
- - [工具与权限参考](TOOLS.md):参数、限额、scope、管理 API。
5
+ Every guide in `docs/` is available in two languages. The unsuffixed file (for example `DEPLOYMENT.md`) is the canonical English version; the `.zh-CN.md` file is the aligned Simplified Chinese translation. CLI commands, configuration keys and API paths are identical across languages and platforms.
10
6
 
11
- ## 维护与安全
7
+ ## Usage
12
8
 
13
- - [安全模型](../SECURITY.md):信任边界、默认限制、漏洞报告方式。
14
- - [贡献说明](../CONTRIBUTING.md):开发环境、测试和 PR 要求。
15
- - [发布准备](OPEN_SOURCE.md):文件范围、凭据检查、许可证与源码归档。
16
- - [验证记录](VALIDATION.md):已执行的检查与未执行的验收。
17
- - [变更记录](../CHANGELOG.md):当前公开版本范围。
18
- - [第三方声明](../THIRD_PARTY_NOTICES.md):生产依赖许可证与设计参考。
9
+ - [Deployment, Pairing, and Operations](DEPLOYMENT.md): native/Compose setup, HTTPS, reverse proxies, Runner, autostart, backups.
10
+ - [Connecting AI Clients](CLIENTS.md): OAuth/PAT, protocol and tool-call examples.
11
+ - [Daily Remote Development Workflow](DEVELOPMENT_WORKFLOW.md): command profiles, line-range reads, multi-file edits, output tails, safe commits and session handoff.
12
+ - [Remote Assist](REMOTE_ASSIST.md): one-time invitations, local temporary approval, independent deadlines and immediate revocation.
13
+ - [Tool and Admin Reference](TOOLS.md): parameters, limits, scopes and admin API.
19
14
 
20
- ## 设计资料
15
+ ## Maintenance and Security
21
16
 
22
- - [架构与技术选型](ARCHITECTURE.md)。
23
- - [参考项目比较](COMPARISON.md)。
24
- - [WebCodex 源码对照](WEBCODEX_CODE_AUDIT.md)。
25
- - [逐工具静态清单](webcodex-source-inventory.json)与[分类规则](webcodex-parity-map.json)。
17
+ - [Security Model](../SECURITY.md): trust boundaries, default limits and vulnerability reporting.
18
+ - [Contributing](../CONTRIBUTING.md): development environment, tests and PR requirements.
19
+ - [Open Source and Release](OPEN_SOURCE.md): file inventory, credential checks, licenses and source archives.
20
+ - [Validation Record](VALIDATION.md): checks performed and acceptance still outstanding.
21
+ - [Changelog](../CHANGELOG.md): scope of the current public release.
22
+ - [Third-Party Notices](../THIRD_PARTY_NOTICES.md): production dependency licenses and design references.
26
23
 
27
- 源码清单是固定上游修订的设计审计材料,不包含上游实现,也不代表功能对等或已通过公开 CI。运行该清点脚本需要在本地另行检出指定参考修订;参考 checkout 不属于发布内容。
24
+ ## Design Materials
25
+
26
+ - [Architecture and Technology Choices](ARCHITECTURE.md).
27
+ - [Reference Project Comparison](COMPARISON.md).
28
+ - [WebCodex Source Audit](WEBCODEX_CODE_AUDIT.md).
29
+ - [Per-tool static inventory](webcodex-source-inventory.json) and [classification rules](webcodex-parity-map.json).
30
+
31
+ The source inventory is a design-audit artifact of a fixed upstream revision. It contains no upstream implementation and does not imply feature parity or a passing public CI run. Running the inventory script requires a separate local checkout of the pinned reference revision; that checkout is not part of the release.
@@ -0,0 +1,31 @@
1
+ # 文档索引
2
+
3
+ [English](README.md) · **简体中文**
4
+
5
+ `docs/` 下的每篇指南都提供两种语言。无后缀文件(例如 `DEPLOYMENT.md`)是英文规范版,`.zh-CN.md` 是内容对齐的简体中文版。CLI 命令、配置键与 API 路径在两种语言和各平台上完全一致。
6
+
7
+ ## 使用
8
+
9
+ - [部署、配对与运维](DEPLOYMENT.zh-CN.md):原生/Compose、HTTPS、反代、Runner、自启动、备份。
10
+ - [AI 客户端接入](CLIENTS.zh-CN.md):OAuth/PAT、协议与调用方式。
11
+ - [日常开发流程](DEVELOPMENT_WORKFLOW.zh-CN.md):命令环境、按行读取、多文件编辑、日志、安全提交与接续。
12
+ - [远程协助](REMOTE_ASSIST.zh-CN.md):邀请朋友、本机临时批准、独立到期与立即停止。
13
+ - [工具与权限参考](TOOLS.zh-CN.md):参数、限额、scope、管理 API。
14
+
15
+ ## 维护与安全
16
+
17
+ - [安全模型](../SECURITY.md):信任边界、默认限制、漏洞报告方式。
18
+ - [贡献说明](../CONTRIBUTING.md):开发环境、测试和 PR 要求。
19
+ - [发布准备](OPEN_SOURCE.zh-CN.md):文件范围、凭据检查、许可证与源码归档。
20
+ - [验证记录](VALIDATION.zh-CN.md):已执行的检查与未执行的验收。
21
+ - [变更记录](../CHANGELOG.md):当前公开版本范围。
22
+ - [第三方声明](../THIRD_PARTY_NOTICES.md):生产依赖许可证与设计参考。
23
+
24
+ ## 设计资料
25
+
26
+ - [架构与技术选型](ARCHITECTURE.zh-CN.md)。
27
+ - [参考项目比较](COMPARISON.zh-CN.md)。
28
+ - [WebCodex 源码对照](WEBCODEX_CODE_AUDIT.zh-CN.md)。
29
+ - [逐工具静态清单](webcodex-source-inventory.json)与[分类规则](webcodex-parity-map.json)。
30
+
31
+ 源码清单是固定上游修订的设计审计材料,不包含上游实现,也不代表功能对等或已通过公开 CI。运行该清点脚本需要在本地另行检出指定参考修订;参考 checkout 不属于发布内容。
@@ -1,46 +1,48 @@
1
- # Remote Assist · 远程协助
1
+ # Remote Assist
2
2
 
3
- Remote Assist 是 HomeAgent 的临时连接模式。设备持有人无需管理员账号或模型 API Key,在自己的 Runner 中批准 1–16 个项目、各自的操作权限和统一时长;Runner 独立决定请求是否能执行。Personal / Work 的普通永久配对仍保持原行为。
3
+ **English** · [简体中文](REMOTE_ASSIST.zh-CN.md)
4
4
 
5
- ## 使用流程
5
+ Remote Assist is HomeAgent's temporary connection mode. The device owner needs no administrator account or model API key: they approve 1–16 projects, per-project permissions and a shared duration in their own Runner, and the Runner independently decides whether a request may execute. Ordinary permanent Personal/Work pairings keep their existing behavior.
6
6
 
7
- 1. 操作者先在 AI 客户端建立 OAuth/PAT 连接,并授予所需 read/write/execute scopes。
8
- 2. Dashboard 的「设备与项目」→「邀请朋友」中选择该客户端授权、请求方显示名称、允许请求的权限和最长时长。
9
- 3. 生成后点击「复制连接命令」,私下发给朋友。命令包含后端域名和 10 分钟有效的一次性邀请,例如 `homeagent assist "https://你的后端域名/assist#id=…&token=…"`,无需朋友另行配置服务地址。也可单独复制邀请链接;打开链接不会消费邀请。邀请是 bearer capability,持有者可领取,不是朋友身份验证。
10
- 4. 朋友安装 Runner 后,将完整命令粘贴到终端,即可进入本机审批。命令中的邀请密钥可能留在终端历史中;不希望留在历史时,运行 `homeagent assist` 后输入链接,或运行 `homeagent`,在设置中选择「加入远程协助」再粘贴链接。
11
- 5. 在本机项目清单中添加、修改或移除项目。当前目录使用手工绝对路径输入;每个项目单独选择只读/文件写入及指定程序,例如源码可编辑、资料只读。完成清单后选择 30 分钟 / 2 小时 / 8 小时内的统一时长,并逐项核对。
12
- 6. 最终批准后立即开始本机计时。权限应用成功后,绑定客户端通过原有 `/mcp` 调用 `list_devices`,使用返回的准确 deviceId 和项目 ID 开始工作,不需要更换模型或客户端凭据。新流程的项目 ID 在本机草稿创建时生成,不固定为 `assist`。
13
- 7. 本机「立即停止」、退出、到期、断线或绑定授权变更会结束全部项目的会话。批准后清单固定;添加项目、换目录或扩权需要结束旧会话,创建新邀请并重新本机批准。
7
+ ## Usage Flow
14
8
 
15
- 邀请允许请求的范围不是实际执行权限。最终范围是当前客户端授权、邀请/会话范围与本机批准的交集;其他客户端不会因为设备出现而自动得到权限。
9
+ 1. The operator first establishes an OAuth/PAT connection in the AI client and grants the required read/write/execute scopes.
10
+ 2. In the Dashboard under **Devices & Projects → Invite a Friend**, choose that client authorization, the requester's display name, the permissions that may be requested and the maximum duration.
11
+ 3. After generation, click **Copy connection command** and send it privately to the friend. The command contains the backend domain and a one-time invitation valid for 10 minutes, for example `homeagent assist "https://your-backend-domain/assist#id=…&token=…"`, so the friend does not need to configure a service address separately. The invitation link can also be copied alone; opening it does not consume the invitation. An invitation is a bearer capability: whoever holds it can claim it, not an identity verification of the friend.
12
+ 4. After the friend installs the Runner, paste the full command into the terminal to enter local approval. The invitation key in the command may remain in terminal history; if you do not want that, run `homeagent assist` and enter the link, or run `homeagent` and choose "Join Remote Assist" in Settings before pasting the link.
13
+ 5. Add, edit or remove projects in the local project list. The current directory uses manual absolute path input; each project separately selects read-only / file-write and specified programs — for example source code editable, reference material read-only. After finalizing the list, choose a shared duration of 30 minutes / 2 hours / 8 hours and verify each item.
14
+ 6. Local timing starts immediately after final approval. Once permissions are applied, the bound client calls `list_devices` through the original `/mcp` and starts work with the exact returned `deviceId` and project IDs; no model or client credentials need to change. In the new flow project IDs are generated when the local draft is created and are not fixed to `assist`.
15
+ 7. Local "Stop now", exit, expiry, disconnect or a change to the bound authorization ends the session for all projects. The list is fixed after approval; adding projects, changing directories or widening permissions requires ending the old session, creating a new invitation and re-approving locally.
16
16
 
17
- ## 本机上限
17
+ The scopes an invitation permits requesting are not the actual execution permissions. The final scope is the intersection of the current client authorization, the invitation/session scopes and the local approval; other clients do not automatically gain permissions because the device appears.
18
18
 
19
- - 1–16 个项目、唯一 ID、项目级路径,保留私有配置与默认排除项;不得由 Server 增加根目录、移除排除项或开放设备级路径。重复和父子重叠目录不能共享。
20
- - 每项目默认只读。文件写入与程序执行分别确认;每项目最多 16 个程序,全会话最多 64 个。程序只接受所有共享根之外安装的绝对可执行文件路径,禁止另一个可写项目替换获准入口;不支持任意程序模式、远端 alias/environment profile。
21
- - 只允许受控 Git 只读工具;MVP 不开放 Git 写入、push、网络或 linked worktree 的外部 common directory。
22
- - 本机固定期限使用单调计时和墙钟最早截止,Server 修改时间或系统时钟回拨不能延长。
23
- - 临时连接使用独立私有状态目录,不覆盖普通 Runner 配置/凭据,不保存可自动恢复的批准,不安装自启动。
24
- - 新授权要求交互式本机终端;服务和非 TTY 脚本不能静默批准。`--plain` 仅改变显示方式,不取消本机审批。
19
+ ## Local Limits
25
20
 
26
- ## 版本兼容
21
+ - 1–16 projects, unique IDs, project-level paths, with private configuration and default exclusions preserved; the Server cannot add roots, remove exclusions or open device-level paths. Duplicate and parent/child overlapping directories cannot be shared.
22
+ - Each project is read-only by default. File writes and program execution are confirmed separately; up to 16 programs per project and 64 for the whole session. Programs accept only absolute executable paths installed outside all shared roots, so another writable project cannot replace an approved entry point; arbitrary-program mode, remote aliases and environment profiles are not supported.
23
+ - Only controlled read-only Git tools are allowed; Git writes, push, network and external common directories of linked worktrees are not exposed by Remote Assist.
24
+ - The local fixed deadline uses monotonic timing and the earliest wall-clock cutoff; Server time changes or a system clock rollback cannot extend it.
25
+ - Temporary connections use a separate private state directory, do not overwrite ordinary Runner config/credentials, do not save auto-recoverable approvals and do not install autostart.
26
+ - New authorization requires an interactive local terminal; services and non-TTY scripts cannot approve silently. `--plain` changes only the display, not local approval.
27
27
 
28
- 普通 Runner protocol 2 不变。新多项目流程使用 `remote-assist-multi-v1`、`/assist/v2/inspect` 与 `/assist/v2/claim`;邀请链接及连接命令不变。新 Runner 遇旧 Server 明确提示升级,不降级成普通配对,也不会只共享首个项目。新 Server 保留旧 `remote-assist-v1` 单项目流程,旧持久化批准记录仍可显示,但已结束会话不能恢复。
28
+ ## Version Compatibility
29
29
 
30
- 网页盘符/目录选择器及本机目录导航尚未接入;普通设备仍可在网页手工填写多个项目路径,新增项目仍需另行选择客户端授权范围。
30
+ The ordinary Runner protocol 2 is unchanged. The new multi-project flow uses `remote-assist-multi-v1` with `/assist/v2/inspect` and `/assist/v2/claim`; the invitation link and connection command are unchanged. A new Runner meeting an older Server explicitly asks for an upgrade, does not downgrade to an ordinary pairing and does not share only the first project. A new Server keeps the legacy `remote-assist-v1` single-project flow; old persisted approval records can still be shown, but ended sessions cannot be resumed.
31
31
 
32
- ## 停止与观察
32
+ Web drive/directory pickers and local directory navigation are not integrated; ordinary devices can still enter multiple project paths manually on the web page, and newly added projects still need separate client authorization scope selection.
33
33
 
34
- 停止先阻止新操作和排队请求,再取消调用并清理托管进程树。界面区分访问已封锁、任务停止已确认、停止失败与离线未确认。清理失败不能恢复访问,可在本机再次请求清理。
34
+ ## Stopping and Observation
35
35
 
36
- Dashboard 展示会话及任务元数据,不能用管理员 impersonation 绕过本机授权读取协助内容;输出由绑定 MCP 客户端读取。本机状态目录保留有界参数摘要审计和现有任务输出,活动界面可查看状态。Server 审计不是抗管理员篡改账本。
36
+ Stopping first blocks new operations and queued requests, then cancels calls and cleans up hosted process trees. The UI distinguishes access blocked, job stop confirmed, stop failed and offline-unconfirmed. A cleanup failure cannot restore access; another cleanup can be requested locally.
37
37
 
38
- ## 必须理解的风险
38
+ The Dashboard shows session and job metadata; administrator impersonation cannot bypass local authorization to read assistance content, and output is read by the bound MCP client. The local state directory keeps bounded argument-digest audits and existing job output, and the Activity view shows status. The Server audit is not an administrator-tamper-proof ledger.
39
39
 
40
- Server 仍负责客户端认证并声明操作者身份。本机授权限制 Server 的执行范围,不提供请求方端到端身份证明。持邀请链接者可领取,请使用可信 Server、私下分享链接。
40
+ ## Risks You Must Understand
41
41
 
42
- **允许解释器或构建工具仍允许它们使用 Runner 系统账户权限。** 程序列表限制入口,不限制 AI 提供的参数或项目脚本行为;它们可能访问项目外文件、网络、凭据或启动外部服务。需要强隔离时使用低权限账户、容器/VM,Linux 强杀场景应有 cgroup/systemd 约束。可写项目也可能触发已有热加载服务。
42
+ The Server still authenticates the client and asserts the operator identity. Local authorization limits the Server's execution scope but does not provide end-to-end proof of the requester's identity. Anyone holding the invitation link can claim it, so use a trusted Server and share the link privately.
43
43
 
44
- 没有模型 API Key 不等于没有数据传输。读取的代码、文件和执行结果会返回操作者的 AI 客户端,并可能进入所选模型服务。公司设备和资料必须符合组织授权、数据政策和 AI 使用政策。
44
+ **Allowing an interpreter or build tool still allows it to use the privileges of the Runner system account.** The program list restricts entry points, not the arguments an AI supplies or the behavior of project scripts; they may access files outside the project, the network, credentials or start external services. For strong isolation use a low-privilege account, container/VM, and cgroup/systemd constraints for Linux force-kill scenarios. A writable project may also trigger existing hot-reload services.
45
45
 
46
- 撤销不能回滚已完成修改、终止所有外部服务或收回已经传输的数据。本功能不是 OS 沙箱、远程桌面、离线 supervisor 或多租户系统。
46
+ "no model API key" does not mean "no data transfer". Read code, files and execution results go back to the operator's AI client and may enter the chosen model service. Company devices and data must comply with organizational authorization, data policy and AI usage policy.
47
+
48
+ Revocation cannot roll back completed edits, terminate all external services or take back already-transmitted data. This feature is not an OS sandbox, remote desktop, offline supervisor or multi-tenant system.
@@ -0,0 +1,48 @@
1
+ # Remote Assist · 远程协助
2
+
3
+ [English](REMOTE_ASSIST.md) · **简体中文**
4
+
5
+ Remote Assist 是 HomeAgent 的临时连接模式。设备持有人无需管理员账号或模型 API Key,在自己的 Runner 中批准 1–16 个项目、各自的操作权限和统一时长;Runner 独立决定请求是否能执行。Personal / Work 的普通永久配对仍保持原行为。
6
+
7
+ ## 使用流程
8
+
9
+ 1. 操作者先在 AI 客户端建立 OAuth/PAT 连接,并授予所需 read/write/execute scopes。
10
+ 2. Dashboard 的「设备与项目」→「邀请朋友」中选择该客户端授权、请求方显示名称、允许请求的权限和最长时长。
11
+ 3. 生成后点击「复制连接命令」,私下发给朋友。命令包含后端域名和 10 分钟有效的一次性邀请,例如 `homeagent assist "https://你的后端域名/assist#id=…&token=…"`,无需朋友另行配置服务地址。也可单独复制邀请链接;打开链接不会消费邀请。邀请是 bearer capability,持有者可领取,不是朋友身份验证。
12
+ 4. 朋友安装 Runner 后,将完整命令粘贴到终端,即可进入本机审批。命令中的邀请密钥可能留在终端历史中;不希望留在历史时,运行 `homeagent assist` 后输入链接,或运行 `homeagent`,在设置中选择「加入远程协助」再粘贴链接。
13
+ 5. 在本机项目清单中添加、修改或移除项目。当前目录使用手工绝对路径输入;每个项目单独选择只读/文件写入及指定程序,例如源码可编辑、资料只读。完成清单后选择 30 分钟 / 2 小时 / 8 小时内的统一时长,并逐项核对。
14
+ 6. 最终批准后立即开始本机计时。权限应用成功后,绑定客户端通过原有 `/mcp` 调用 `list_devices`,使用返回的准确 `deviceId` 和项目 ID 开始工作,不需要更换模型或客户端凭据。新流程的项目 ID 在本机草稿创建时生成,不固定为 `assist`。
15
+ 7. 本机「立即停止」、退出、到期、断线或绑定授权变更会结束全部项目的会话。批准后清单固定;添加项目、换目录或扩权需要结束旧会话,创建新邀请并重新本机批准。
16
+
17
+ 邀请允许请求的范围不是实际执行权限。最终范围是当前客户端授权、邀请/会话范围与本机批准的交集;其他客户端不会因为设备出现而自动得到权限。
18
+
19
+ ## 本机上限
20
+
21
+ - 1–16 个项目、唯一 ID、项目级路径,保留私有配置与默认排除项;不得由 Server 增加根目录、移除排除项或开放设备级路径。重复和父子重叠目录不能共享。
22
+ - 每项目默认只读。文件写入与程序执行分别确认;每项目最多 16 个程序,全会话最多 64 个。程序只接受所有共享根之外安装的绝对可执行文件路径,禁止另一个可写项目替换获准入口;不支持任意程序模式、远端 alias/environment profile。
23
+ - 只允许受控 Git 只读工具;Remote Assist 不开放 Git 写入、push、网络或 linked worktree 的外部 common directory。
24
+ - 本机固定期限使用单调计时和墙钟最早截止,Server 修改时间或系统时钟回拨不能延长。
25
+ - 临时连接使用独立私有状态目录,不覆盖普通 Runner 配置/凭据,不保存可自动恢复的批准,不安装自启动。
26
+ - 新授权要求交互式本机终端;服务和非 TTY 脚本不能静默批准。`--plain` 仅改变显示方式,不取消本机审批。
27
+
28
+ ## 版本兼容
29
+
30
+ 普通 Runner protocol 2 不变。新多项目流程使用 `remote-assist-multi-v1`、`/assist/v2/inspect` 与 `/assist/v2/claim`;邀请链接及连接命令不变。新 Runner 遇旧 Server 明确提示升级,不降级成普通配对,也不会只共享首个项目。新 Server 保留旧 `remote-assist-v1` 单项目流程,旧持久化批准记录仍可显示,但已结束会话不能恢复。
31
+
32
+ 网页盘符/目录选择器及本机目录导航尚未接入;普通设备仍可在网页手工填写多个项目路径,新增项目仍需另行选择客户端授权范围。
33
+
34
+ ## 停止与观察
35
+
36
+ 停止先阻止新操作和排队请求,再取消调用并清理托管进程树。界面区分访问已封锁、任务停止已确认、停止失败与离线未确认。清理失败不能恢复访问,可在本机再次请求清理。
37
+
38
+ Dashboard 展示会话及任务元数据,不能用管理员 impersonation 绕过本机授权读取协助内容;输出由绑定 MCP 客户端读取。本机状态目录保留有界参数摘要审计和现有任务输出,活动界面可查看状态。Server 审计不是抗管理员篡改账本。
39
+
40
+ ## 必须理解的风险
41
+
42
+ Server 仍负责客户端认证并声明操作者身份。本机授权限制 Server 的执行范围,不提供请求方端到端身份证明。持邀请链接者可领取,请使用可信 Server、私下分享链接。
43
+
44
+ **允许解释器或构建工具仍允许它们使用 Runner 系统账户权限。** 程序列表限制入口,不限制 AI 提供的参数或项目脚本行为;它们可能访问项目外文件、网络、凭据或启动外部服务。需要强隔离时使用低权限账户、容器/VM,Linux 强杀场景应有 cgroup/systemd 约束。可写项目也可能触发已有热加载服务。
45
+
46
+ 没有模型 API Key 不等于没有数据传输。读取的代码、文件和执行结果会返回操作者的 AI 客户端,并可能进入所选模型服务。公司设备和资料必须符合组织授权、数据政策和 AI 使用政策。
47
+
48
+ 撤销不能回滚已完成修改、终止所有外部服务或收回已经传输的数据。本功能不是 OS 沙箱、远程桌面、离线 supervisor 或多租户系统。