问题
通过 pi install npm:@tt-a1i/openpi(v0.5.0)安装后,在 Pi TUI 中执行 /web,提示 OpenPI Web Workbench exited with code 1.;直接运行 openpi web 同样失败。
复现
pi list
# npm:@tt-a1i/openpi
# ~/.pi/agent/npm/node_modules/@tt-a1i/openpi
cd ~/.pi/agent/npm/node_modules/@tt-a1i/openpi/bin
node openpi.js web --no-workspace --no-open
输出:
Failed to start OpenPI Web Workbench: Cannot find module '@earendil-works/pi-coding-agent'
Require stack:
- ~/.pi/agent/npm/node_modules/@tt-a1i/openpi/web/runtime/pi-runtime.ts
进程以 exit code 1 退出(bin/openpi.js 的 catch 分支)。/web 清屏并恢复 TUI 后,这段 stderr 被刷掉,用户只能看到 exit code 1。
根因
@earendil-works/pi-coding-agent(以及 pi-ai / pi-tui / typebox)声明在 peerDependencies(package.json),pi install npm: 不会安装 peer 依赖,~/.pi/agent/npm/node_modules 下不存在 @earendil-works;
/web 由 extensions/web/index.ts spawn 一个独立 node 进程(bin/openpi.js → jiti 导入 web/runtime/pi-runtime.ts,其中运行时 import 了 SessionManager 等真实值),不再享有 Pi 宿主进程内的模块解析;
- 开发环境因为 devDependencies 同名安装而解析成功,所以该问题只在 npm 安装路径暴露——即所有 npm 用户的
/web 必然失败。
可能的修复方向
- 父扩展(运行在 Pi 进程内,可以正常 resolve)在 spawn 前把
@earendil-works/pi-coding-agent 的解析路径传给子进程(env / 参数),子进程侧用该路径建立 jiti alias 或模块重定向;
- 发布制品把 web 运行时用到的 pi-coding-agent 代码打包进 npm 包(bundle),消除运行时 peer 解析;
- 或者文档声明
openpi web 需要从装了 dev 依赖的 checkout / 全局安装了 pi-coding-agent 的位置运行(最弱方案)。
临时绕过
把全局 Pi 安装里的 scoped 包链接进 npm 包解析路径即可恢复:
ln -s "$(npm root -g)/@earendil-works" ~/.pi/agent/npm/node_modules/@earendil-works
(pi-coding-agent 自带 pi-ai / pi-tui / typebox 等全部依赖,单个符号链接即可满足解析;升级 openpi 后需检查链接是否仍有效。)
环境
- openpi: 0.5.0(npm,
pi list 唯一来源)
- pi: 全局安装于 fnm 的 node v24.19.0
- macOS(zsh/bash)
问题
通过
pi install npm:@tt-a1i/openpi(v0.5.0)安装后,在 Pi TUI 中执行/web,提示OpenPI Web Workbench exited with code 1.;直接运行openpi web同样失败。复现
输出:
进程以 exit code 1 退出(
bin/openpi.js的 catch 分支)。/web 清屏并恢复 TUI 后,这段 stderr 被刷掉,用户只能看到 exit code 1。根因
@earendil-works/pi-coding-agent(以及 pi-ai / pi-tui / typebox)声明在peerDependencies(package.json),pi install npm:不会安装 peer 依赖,~/.pi/agent/npm/node_modules下不存在@earendil-works;/web由extensions/web/index.tsspawn 一个独立 node 进程(bin/openpi.js→ jiti 导入web/runtime/pi-runtime.ts,其中运行时 import 了SessionManager等真实值),不再享有 Pi 宿主进程内的模块解析;/web必然失败。可能的修复方向
@earendil-works/pi-coding-agent的解析路径传给子进程(env / 参数),子进程侧用该路径建立 jiti alias 或模块重定向;openpi web需要从装了 dev 依赖的 checkout / 全局安装了 pi-coding-agent 的位置运行(最弱方案)。临时绕过
把全局 Pi 安装里的 scoped 包链接进 npm 包解析路径即可恢复:
(pi-coding-agent 自带 pi-ai / pi-tui / typebox 等全部依赖,单个符号链接即可满足解析;升级 openpi 后需检查链接是否仍有效。)
环境
pi list唯一来源)