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

@agentdevjs/image-reader-feature

v0.1.0

Published

Image reader feature for AgentDev - provides read_image tool to inject local images into conversation context

Downloads

87

Readme

@agentdevjs/image-reader-feature

图片读取 Feature,提供 read_image 工具,让 Agent 能主动读取本地图片文件并直接注入到对话上下文中。

安装

npm install @agentdevjs/image-reader-feature

使用

import { ImageReaderFeature } from '@agentdevjs/image-reader-feature';

agent.use(new ImageReaderFeature({
  workspaceDir: '/path/to/project',
  storageDir: '/path/to/managed/images',
}));

工具

read_image

读取本地图片文件,将图片注入到对话上下文中。支持 PNG、JPEG、GIF、WebP、BMP、SVG 格式。

参数:

  • path (string, required): 图片文件路径(绝对路径或相对于工作目录的相对路径)

返回:

  • 成功:图片被注入到上下文,文本结果显示文件信息
  • 失败:错误信息(文件不存在、格式不支持、文件过大等)

技术细节

工具使用框架的 withImages() 机制返回图片数据。框架会自动处理:

  • 视觉模式(vision: true):图片以原生格式注入到 LLM 请求中
    • Anthropic:嵌入 tool_result.content 数组
    • OpenAI Chat:追加一条 user 消息携带图片
    • OpenAI Responses:追加一条 user 消息携带图片
  • 非视觉模式(vision: false):图片降级为文字占位符,模型知道有图片但无法看到内容

调用 read_image 时,Feature 会立即读取原文件,并按内容 SHA-256 哈希复制到受管目录。ImageInput.path 指向这个受管快照,而 source 保留原路径用于展示和非视觉占位符。这样既避免 session 内联 Base64 膨胀,也保证原文件后续修改、移动或删除不会改变历史上下文。

  • storageDir 可由宿主指定;默认是 ~/.agentdev/images
  • 相同内容会复用同一个受管文件
  • 宿主应把受管目录视为持久化会话附件,不应在会话仍可能恢复时清理