npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@wbline/pi-vision

v0.3.0

Published

Vision capabilities for Pi coding agent — image understanding and visual analysis

Readme

pi-vision

Pi coding agent 的视觉能力扩展 —— 安装后即获得 read_image 工具,自动把图片交给支持视觉的模型描述。零配置,开箱即用。

pi install npm:@wbline/pi-vision

使用方法

直接让 agent 看图即可,例如:

看一下 ./error.png 这张截图,告诉我报错内容是什么。

LLM 会调用 read_image 工具:

{
  "path": "./error.png",
  "prompt": "转录截图中的报错信息并给出修复建议,用用户的语言回答。"
}

| 参数 | 必填 | 说明 | |----------|------|------------------------------------------------------| | path | ✓ | 图片路径(绝对路径或工作区相对路径) | | prompt | ✓ | 关注点描述,用用户的语言(如"转录报错"、"描述场景") |

成功时的返回示例:

截图显示一个 TypeScript 编译错误:TS2345 "Argument of type 'string' is not
assignable to parameter of type 'number'",位于 src/utils.ts:42 ...

[image: PNG, 148.3 KB, described by opencode/exo-free]

工作原理

  • 就近优先:优先使用当前会话模型(若支持图像输入,零额外开销)
  • 自动降级:失败时按轮次回退——每轮遍历各 provider 最好的视觉模型,同 provider 备选模型在后几轮,最多 3 轮
  • 限时尝试:每个模型单次尝试最长 60 秒,超时视为失败并继续降级,网关挂起不会卡住工具
  • 纯净请求:视觉请求固定不携带思考参数(reasoning: "off"、不发 reasoning_effort),从根源上避开部分网关的 reasoning_effort 校验问题

状态反馈

| 位置 | 行为 | |----------------|--------------------------------------------------------------------------| | 底部状态栏 | 👁 模型名 实时显示当前视觉模型,随识图与模型切换自动刷新;手动固定时带 (pinned) 标注 | | /vision 命令 | 无参数时弹出交互式选择框(方向键选择、回车确认);也支持直接传模型名固定 | | 识图播报 | read_image 真正执行时才提示实际服务的模型;模型变化时才再次提示,不刷屏 | | 启动提示 | 编辑器上方显示一次加载信息,首次输入后消失 |

手动指定视觉模型

默认自动选择(就近优先 + 失败降级)。需要固定某个模型时:

  • /vision —— 弹出选择框:列出 auto 和所有可用视觉模型(标注当前服务的 ← current 与已固定的 ← pinned),方向键选择、回车确认,Esc 取消
  • /vision <provider/model> —— 直接固定视觉模型(支持只写模型 id 或部分名称,唯一匹配即生效;也可用输入框的下拉补全)
  • /vision auto —— 恢复自动选择

固定的模型仍享有失败降级:它不可用或识图失败时,会自动回退到其他视觉模型。固定为会话级,重启 pi 后恢复自动。

TUI 与 ACP 客户端(如 JetBrains IDE)均适用。

支持格式与限制

  • 格式:png、jpg、jpeg、gif、webp、bmp(仅位图 —— 不支持 SVG)
  • 大小:单张图片最大 5 MB
  • 校验:按文件头(magic bytes)确认内容与扩展名一致,改名或损坏的文件直接报错,不会发给模型
  • 隐私:read_image 会把图片完整上传给所选视觉模型所在的 provider,处理含密码、token 的敏感截图时请留意
  • 需至少一个已配置认证且支持图像输入的模型(内置 provider 通过 /login 登录即可)

自定义模型

Pi 未内置的兼容端点,在 ~/.pi/agent/models.json 中为模型声明 "input": ["text", "image"],即可参与识图:

{
  "providers": {
    "my-provider": {
      "baseUrl": "https://your-server.com/v1",
      "api": "openai-completions",
      "apiKey": "sk-...",
      "models": [
        { "id": "my-vision-model", "input": ["text", "image"] }
      ]
    }
  }
}

许可证

MIT © wongbin