feat(local): 技能通用规则进提示词,移除 skills/AGENTS.md 中转
- env-local 加两条:长任务后台写日志+10 秒轮询;国内 pip/npm/GitHub/brew 换源 - 4 个技能 AGENTS.md 删掉指向根文档的指针行;pip 命令补 --upgrade - document-photo-to-pdf:自检未能执行时单独给摘要,不再伪装成「建议确认」 - SKILL.md 示例去掉真实域名,改成 <站点地址> - 删除 skills/AGENTS.md(根级中转文档,靠出错时翻文件拉不动)
This commit is contained in:
@@ -2,5 +2,10 @@
|
||||
conversations share it and `/tmp` is the system temp dir. Work inside the
|
||||
working directory; treat everything outside it as the user's.
|
||||
- `python3` may be missing. Install what a task needs; Python packages go into
|
||||
`$AGENT_SKILLS_DEPS`. If a skill fails, read its own `AGENTS.md`
|
||||
`$AGENT_SKILLS_DEPS`. If a skill fails, cat its own `AGENTS.md`
|
||||
(`"$(dirname "$AGENT_SKILLS_DEPS")/<skill>/AGENTS.md"`) and follow it.
|
||||
- Installs and big downloads stay silent until they end. Run them in the background
|
||||
with output to a log file and poll that file every ~10s, instead of one long timeout.
|
||||
- Slow or failing installs and downloads: switch mirrors instead of retrying — pip
|
||||
`-i https://pypi.tuna.tsinghua.edu.cn/simple`, npm `--registry=https://registry.npmmirror.com`,
|
||||
GitHub URLs prefixed with `https://gh-proxy.com/`, Homebrew mirrors or let the user install.
|
||||
|
||||
+5
-4
@@ -289,9 +289,10 @@ health 只作为「端口上有服务但不是本启动器拉起的」兜底提
|
||||
(报什么错、敲什么),不写背景、不提服务器。起点是 `env-local` 提示词的一句话:技能失败就读
|
||||
`"$(dirname "$AGENT_SKILLS_DEPS")/<技能>/AGENTS.md"`。装完不需要重启,旧进程不影响。
|
||||
|
||||
分两层写,避免四份重复漂移:技能目录的 `AGENTS.md` 只写该技能特有的(缺哪个包、缺什么系统库);
|
||||
网络类的(pip / npm / GitHub / brew 换源)全局只需要一份,放在技能根目录
|
||||
`"$(dirname "$AGENT_SKILLS_DEPS")/AGENTS.md"`,各技能的清单末尾指过去。
|
||||
分两层,各管各的:**技能目录的 `AGENTS.md` 只写该技能特有的**(缺哪个包、缺什么系统库);
|
||||
**网络换源与长任务这类通用规则不进技能文档**,直接写在 `env-local.txt` 提示词里——
|
||||
它们必须常驻上下文,靠「出错时去翻文件」是拉不动的(尤其长任务:AI 决定跑 `brew install` 的
|
||||
那一刻没有任何报错信号触发它去查文档)。
|
||||
|
||||
代价明写:`office` 的命令入口在本地不在 PATH 上,按次 `PATH="$SK/scripts:$PATH" office ...` 即可
|
||||
(这是它 `AGENTS.md` 的第一条)。
|
||||
@@ -303,7 +304,7 @@ health 只作为「端口上有服务但不是本启动器拉起的」兜底提
|
||||
| `office` 封装层 ENOENT | 本技能 `AGENTS.md` 绝对路径 |
|
||||
| `x2pdf` 缺包 / 无渲染后端 | 同上 |
|
||||
| `image-process` 缺中文字体 | 同上(并提示传 `font`) |
|
||||
| 网络类(pip / npm / GitHub / brew) | 由技能清单指到技能根目录的 `AGENTS.md`(只有一份) |
|
||||
| 网络类 / 长任务 | 不进技能文档:写在 `env-local.txt`,常驻上下文 |
|
||||
|
||||
唯一保留的环境相关代码是 `x2pdf` 的 `find_soffice()`:`brew install --cask libreoffice` 后
|
||||
`soffice` 不在 PATH(在 app bundle 内),不探这几个默认位置,“装 LibreOffice 即可”就是假的。
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
# 国内网络
|
||||
|
||||
pip / npm / GitHub / brew 超时或装不上时换源:
|
||||
|
||||
- pip:加 `-i https://pypi.tuna.tsinghua.edu.cn/simple`
|
||||
- npm:加 `--registry=https://registry.npmmirror.com`
|
||||
- GitHub 下载:地址前加 `https://gh-proxy.com/`(备用 `https://ghfast.top/`)
|
||||
- brew:换清华/中科大镜像,或让用户自己装
|
||||
- 缺运行时/系统包用本机包管理器(`apt` / `dnf` / `pacman` / `brew` / `winget`);需要密码时先问用户
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
```
|
||||
skills/
|
||||
├── AGENTS.md # 技能排错与国内网络换源(可选参考;core 不读)
|
||||
└── <skill-name>/
|
||||
├── SKILL.md # 技能描述文件(必须)
|
||||
├── run.py # 技能主入口(Python 脚本,推荐)或 run.sh
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
`ModuleNotFoundError`(`numpy` / `PIL` / `fitz`):把依赖装进 `$AGENT_SKILLS_DEPS`
|
||||
|
||||
```sh
|
||||
python3 -m pip install --target "$AGENT_SKILLS_DEPS" -r "$(dirname "$AGENT_SKILLS_DEPS")/document-photo-to-pdf/requirements.txt"
|
||||
python3 -m pip install --upgrade --target "$AGENT_SKILLS_DEPS" -r "$(dirname "$AGENT_SKILLS_DEPS")/document-photo-to-pdf/requirements.txt"
|
||||
```
|
||||
|
||||
`fitz` 是 `pymupdf` 的 import 名,`pypdfium2` 不用装。没有 `python3` 先装运行时(Windows 上解释器常是 `python` / `py`)。
|
||||
|
||||
网络慢或装不上(pip / GitHub 等):见技能根目录的 `AGENTS.md`。
|
||||
|
||||
@@ -39,7 +39,7 @@ input_schema:
|
||||
|
||||
```json
|
||||
{"ok":true,"summary":"3 页已生成;1 页建议在审核页确认;原始页图见 out/","pdf":"合同_校正.pdf","images":["out/合同_校正-01.png","out/合同_校正-02.png","out/合同_校正-03.png"]}
|
||||
访问地址:https://agent.ai.foresh.com/app/task-20261023-001/doc-review/
|
||||
访问地址:<站点地址>/app/task-20261023-001/doc-review/
|
||||
```
|
||||
|
||||
审核页可拖角、旋转、删页/排序、改纸张与清晰度;改动后点「重新生成 PDF」覆盖同名文件。
|
||||
|
||||
@@ -864,7 +864,11 @@ def process(args, t0):
|
||||
if not state_ok:
|
||||
warnings.append("state 文件写入失败:%s" % state_path)
|
||||
|
||||
if checks.get("ok") is False:
|
||||
if checks.get("ok") is None:
|
||||
# 自检根本没跑(无 PDF 渲染后端等):不能让它伪装成「建议确认」——
|
||||
# 那种情况下页面压根没过边缘/短边检验,模型和用户都得知道判据缺失。
|
||||
summary = "%d 页已生成;PDF 自检未能执行,请在审核页人工确认" % len(ordered_pages)
|
||||
elif checks.get("ok") is False:
|
||||
summary = "%d 页已生成;自检有未通过项" % len(ordered_pages)
|
||||
elif needs:
|
||||
summary = "%d 页已生成;%d 页建议在审核页确认" % (
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
`ModuleNotFoundError: No module named 'PIL'`:把依赖装进 `$AGENT_SKILLS_DEPS`
|
||||
|
||||
```sh
|
||||
python3 -m pip install --target "$AGENT_SKILLS_DEPS" -r "$(dirname "$AGENT_SKILLS_DEPS")/image-process/requirements.txt"
|
||||
python3 -m pip install --upgrade --target "$AGENT_SKILLS_DEPS" -r "$(dirname "$AGENT_SKILLS_DEPS")/image-process/requirements.txt"
|
||||
```
|
||||
|
||||
`中文水印缺少字体`:传 `font` 参数,指向本机任意中文字体文件(ttf/ttc)
|
||||
@@ -13,5 +13,3 @@ python3 -m pip install --target "$AGENT_SKILLS_DEPS" -r "$(dirname "$AGENT_SKILL
|
||||
```
|
||||
|
||||
找字体:Linux `fc-list :lang=zh`;macOS `ls /System/Library/Fonts`;Windows `C:\Windows\Fonts\msyh*`。
|
||||
|
||||
网络慢或装不上(pip / GitHub 等):见技能根目录的 `AGENTS.md`。
|
||||
|
||||
@@ -17,5 +17,3 @@ chmod +x "$SK/bin/officecli"
|
||||
|
||||
资产名是 `{mac,linux,win}-{x64,arm64}`,如 `officecli-mac-arm64`、`officecli-linux-x64`、`officecli-win-x64.exe`;
|
||||
musl 系统(Alpine)用 `officecli-linux-alpine-{x64,arm64}`。`uname -sm` 可判断平台与架构。
|
||||
|
||||
网络慢或装不上(GitHub 下载 / brew 等):见技能根目录的 `AGENTS.md`。
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
`ModuleNotFoundError`(`markdown`)或提示 WeasyPrint 不可用:把依赖装进 `$AGENT_SKILLS_DEPS`
|
||||
|
||||
```sh
|
||||
python3 -m pip install --target "$AGENT_SKILLS_DEPS" -r "$(dirname "$AGENT_SKILLS_DEPS")/x2pdf/requirements.txt"
|
||||
python3 -m pip install --upgrade --target "$AGENT_SKILLS_DEPS" -r "$(dirname "$AGENT_SKILLS_DEPS")/x2pdf/requirements.txt"
|
||||
```
|
||||
|
||||
WeasyPrint 还要系统库 pango/cairo:Linux `apt install libpango-1.0-0 libpangocairo-1.0-0 libcairo2`;
|
||||
@@ -14,5 +14,3 @@ Office 类(docx/xlsx/pptx)报「未找到 LibreOffice」:装一个 LibreOf
|
||||
Windows `winget install TheDocumentFoundation.LibreOffice`)。
|
||||
|
||||
装了 LibreOffice 后文本类也能用(回落路径,`page` 的边距/页码与部分 CSS 不生效),此时不必装 pango。
|
||||
|
||||
网络慢或装不上(pip / brew / winget 等):见技能根目录的 `AGENTS.md`。
|
||||
|
||||
Reference in New Issue
Block a user