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

dsh-inline-image

v1.0.0

Published

DeepSeek Harness (DSH) plugin: serve whitelisted local images over a same-origin route so assistant markdown can embed them / 本地图片内联插件

Readme

dsh-inline-image

English

在 DeepSeek Harness(DSH)对话中内联本地图片。 插件把白名单目录内的本地图片通过同源 GET 路由对外提供,助手回复的标准 Markdown 图片语法即可直接显示磁盘上的图片——无需上传、无需搬运文件:

![图说](/api/inline-image?path=/Volumes/Data/figures/fig1.png)

工作原理

  • 在 DSH web 服务器上注册 GET /api/inline-image?path=<绝对路径>(经 webServer 服务)。
  • 只有位于白名单根目录下的文件才会被提供,其余一律 403。
  • 助手消息里的标准 Markdown 图片语法即可渲染。

安装

dsh plugin --profile web add dsh-inline-image

或手动方式:在 profile 的 package.json(~/.dsh/profiles/<profile>/package.json)中把 "dsh-inline-image": "^1.0.0" 加入 dependencies,把 "dsh-inline-image" 加入 dsh.profile.bundles,然后重装 profile。

配置

默认值:allowedRoots = 整个文件系统(全盘放行),maxBytes = 64 MB。

在 profile 的 cordis.patch.yml(~/.dsh/profiles/<profile>/cordis.patch.yml)中覆盖:

- id: inline-image
  config:
    allowedRoots:
      - /Volumes/Data
      - /Users/you/Pictures
    maxBytes: 104857600

环境变量覆盖(优先级最高;分隔符为 path.delimiter,macOS/Linux 下是 :):

export DSH_INLINE_IMAGE_ROOTS=/Volumes/Data:/Users/you/Pictures

优先级:DSH_INLINE_IMAGE_ROOTS > allowedRoots 配置 > 默认全盘。 allowedRoots 留空时回落到默认全盘(POSIX 下等价于白名单写 /)。 要允许所有目录,显式配置 allowedRoots: ['/'] 即可。

支持格式

.png .jpg .jpeg .gif .webp .svg —— TIFF 浏览器无法显示,请先转成 PNG。

安全模型

| 检查项 | 行为 | | --- | --- | | 请求方法 | 仅 GET —— 其余 405 | | 来源 | 仅同源 —— 跨源请求 403 | | 白名单 | 请求路径必须解析到允许的根目录之下 —— 否则 403 | | 符号链接 | realpath 收敛校验:符号链接无法逃出白名单(白名单根本身是符号链接亦可正常使用) | | 类型 | 扩展名白名单(PNG/JPEG/GIF/WebP/SVG),以真实路径为准 —— 否则 415 | | 大小 | maxBytes 上限 —— 超限 413 | | 响应头 | 所有响应带 X-Content-Type-Options: nosniff;SVG 额外带 Content-Security-Policy: sandbox | | 缓存 | 图片 Cache-Control: private, max-age=300;JSON 错误 no-store |

错误以 JSON 返回 —— { "error": "<原因>" } —— 状态码 400/403/405/413/415。

默认白名单是整个文件系统:凡能访问你 DSH web 服务器的客户端都能读取磁盘上的图片文件。 单用户本机使用没问题;共享或多用户环境请把 allowedRoots 收得尽量窄。

API

GET /api/inline-image?path=<URL 编码的绝对路径>
→ 200 图片字节流 | 4xx JSON 错误

许可

MIT © Samuel Lu