feat(local): 声明技能 Python 依赖,并放开「缺包自装进 skills/deps」

本地没有 agent-executor-init,技能的 requirements.txt 从来没人读:
document-photo-to-pdf(numpy/Pillow/pymupdf)与 image-process(Pillow)
在本机只是碰巧用户的 python 里已经装了。

- 两个技能补 requirements.txt,一律不写版本号:服务端 init 用
  pip install --no-index --dry-run 探测,pin 到与镜像不同的版本会让探测失败,
  反而往 skills/deps 装一份旧的(PYTHONPATH 优先级高于系统 site-packages)
- start.sh 起 core 时注入 AGENT_SKILLS_DEPS(该目录本来就在 PYTHONPATH 里),
  把路径交给模型;terminal 与技能子进程都继承 core 的 env,装完下次运行即生效
- env-local.txt 把「永远不要自己装任何东西」换成「缺包时 --target 装进共享依赖层,
  别动系统 Python」。用 --target 是因为 pip 对它的 PEP 668 拦截明确豁免,
  Homebrew 那种 externally-managed 解释器也能装
- 文档同步:local/README 已知限制、docs/local-mode.md 新增 4.13 记录取舍

服务端不受影响:这三行在 executor 镜像里都已满足(实测 --no-index --dry-run
均 exit 0),init 只写一个 gitignore 里的 .deps_installed 就跳过。
This commit is contained in:
2026-11-11 16:59:28 +08:00
parent 29e4f6e6ea
commit 8764fedabc
6 changed files with 59 additions and 4 deletions
+6 -1
View File
@@ -3,4 +3,9 @@
and `/tmp` is the system temp directory (shared, never cleaned for you). Work
inside the working directory; treat everything outside it as the user's.
- `python3` may be missing; when the skills list below is empty it is not
available. Never install runtimes or system packages yourself.
available. Never install runtimes, system packages, or modify the user's Python
environment. If a skill fails because a Python package is missing
(`ModuleNotFoundError`), install just that package into the shared deps dir and
retry: `python3 -m pip install --target "$AGENT_SKILLS_DEPS" <package>` — that
dir is already on `PYTHONPATH`, and `--target` also works on externally-managed
Pythons (e.g. Homebrew) where a bare `pip install` is refused.