refactor(skills): 本机环境说明改放技能目录的 AGENTS.md,启动器不再特判任何技能

上一版把安装说明写成 INSTALL.md 并在 SKILL.md 里加段落,两处都不对:SKILL.md 是用法说明,
不该塞安装内容;启动器为 office 单独注入 PATH 也不成立,再加技能就得逐条改 start.sh。

- 删除 4 个 INSTALL.md,改为各技能目录下的 AGENTS.md(只写命令:下载/安装/验证、
  平台资产名、字体路径),SKILL.md 恢复原样
- start.sh 去掉 office 的 PATH 注入;技能要命令入口时由 AGENTS.md 指导按次前缀
  (PATH="$SK/scripts:$PATH" office ...)。启动器只保留 AGENT_SKILLS_DEPS 这个路径变量
- 找不到依赖时的指路不放在 core 里做特征匹配,而是各自报错带自己 AGENTS.md 的绝对路径
  (office 封装层 ENOENT / x2pdf 缺包或无后端 / image-process 缺字体)
- env-local 提示词加一句:技能失败就读其目录下的 AGENTS.md

实测:无 PATH 时 office 报 command not found,按 AGENTS.md 加前缀后 --version 正常;
三条缺依赖报错均给出 AGENTS.md 绝对路径。
This commit is contained in:
2026-11-11 19:12:01 +08:00
parent a52b227d8b
commit 4e1c1f36d0
19 changed files with 130 additions and 184 deletions
+27
View File
@@ -0,0 +1,27 @@
# office:本机环境
服务器由镜像与 `agent-executor-init` 准备(跑同目录 `install.sh`)。本机不要跑它,按下面装,装完不需要重启。
```sh
SK="$(dirname "$AGENT_SKILLS_DEPS")/office"
```
## 缺二进制(报 `office.core binary missing`)
```sh
mkdir -p "$SK/bin"
curl -fL --progress-bar -o "$SK/bin/officecli" \
https://github.com/iOfficeAI/OfficeCLI/releases/latest/download/officecli-mac-x64
chmod +x "$SK/bin/officecli" && "$SK/bin/officecli" --version
```
资产名:mac Intel `officecli-mac-x64`、Apple Silicon `officecli-mac-arm64`、Linux `officecli-linux-x64` / `officecli-linux-arm64`。
GitHub 慢时加 `https://gh-proxy.com/` 前缀。用 `latest` 即可,不必对齐服务器的 pin。
## `office` 命令不在 PATH
本机启动器不注入 PATH。按次指定目录:
```sh
PATH="$SK/scripts:$PATH" office help
```
-46
View File
@@ -1,46 +0,0 @@
# 本机安装 officecli(office 技能)
技能三件套:本文件同目录的 `SKILL.md`(用法)、`scripts/office`(Node 封装层,已在 `PATH` 里)、
`bin/officecli`(.NET 单文件二进制,**不入库**)。
服务器上由镜像构建 / `agent-executor-init` 跑同目录的 `install.sh`(只处理 linux-x64)。
**本机不要跑 `install.sh`**,按下面自己下:先装才用,不需要重启 agent(封装层每次执行时才解析二进制路径)。
下文「技能目录」= `$(dirname "$AGENT_SKILLS_DEPS")/office`(本地形态 `AGENT_SKILLS_DEPS` 指向 `<仓库>/skills/deps`)。
## 1. 下载对应平台的资产
| 平台 | 资产名 |
|---|---|
| macOS Apple Silicon | `officecli-mac-arm64` |
| macOS Intel | `officecli-mac-x64` |
| Linux x64 | `officecli-linux-x64` |
| Linux arm64 | `officecli-linux-arm64` |
```bash
mkdir -p "$(dirname "$AGENT_SKILLS_DEPS")/office/bin"
curl -fL --progress-bar \
-o "$(dirname "$AGENT_SKILLS_DEPS")/office/bin/officecli" \
https://github.com/iOfficeAI/OfficeCLI/releases/latest/download/officecli-mac-x64
```
- 用 `latest` 就够(officecli 首次运行也会把自己更新到 latest),不用对齐服务器 pin 的版本。
- 国内慢就换源:`https://gh-proxy.com/https://github.com/iOfficeAI/OfficeCLI/releases/latest/download/<资产>`。
- 约 34MB,超时/断流就重试;`curl -fL` 失败时不会留下半截文件可用。
## 2. 赋可执行位并验证
```bash
chmod +x "$(dirname "$AGENT_SKILLS_DEPS")/office/bin/officecli"
office --version # 或 office help
```
`office` 命令由本地启动器注入 `PATH` 提供(`skills/office/scripts` 目录),不需要建软链、不需要 root。
如果 `office` 不在 PATH(例如手工起 core 没带启动器),可以直接跑
`node "$(dirname "$AGENT_SKILLS_DEPS")/office/scripts/office" help`。
## 3. 装不上怎么办
封装层会报 `office.core binary missing: <路径>`,说明二进制没到位;文档的创建/编辑/读取全部依赖它,
没有它就用别的路子(例如要 PDF 用 `x2pdf` 技能)。**不要**为此改系统目录或去装 .NET 运行时——
该二进制是自包含的。
-1
View File
@@ -34,5 +34,4 @@ create/open 成功后,用户可自行查看该文档的实时预览(预览
## 注意
- 所有操作文档在任务目录里。
- 缺 `bin/officecli`(报 `binary missing`)时:按同目录 `INSTALL.md` 自己装;服务器端由镜像构建 / `agent-executor-init` 提供,本机不要跑 `install.sh`。
- `view` 的渲染族(html/screenshot/pdf 等)本环境不可用;要 PDF 用 x2pdf 技能。
+1 -1
View File
@@ -92,7 +92,7 @@ try {
}
if (r.error) {
if (r.error.code === 'ENOENT') {
err('office.core binary missing: ' + BIN + '\nLocal install steps: ' + path.resolve(__dirname, '..', 'INSTALL.md')
err('office.core binary missing: ' + BIN + '\nLocal env: ' + path.resolve(__dirname, '..', 'AGENTS.md')
+ ' (server: docker compose up -d agent-executor-init)');
}
err(String(r.error.message || r.error));