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

@cxxl/dsh-peek

v0.5.6

Published

DSH Web 内嵌文件预览:点击对话里本轮生成的产物文件(HTML / SVG / Markdown / 图片 / PDF / 代码 / CSV / 字体等)就地预览,不另开浏览器标签、也不用在本地打开文件。

Readme

dsh-peek

给 DeepSeek Harness 的 Web 界面加一个内嵌文件预览器:对话里每轮生成的产物文件(HTML / SVG / Markdown / 图片 / PDF / 音视频 / 代码等)会列成可点击 chips,点击后在同一网页内弹出预览面板——不用另开浏览器标签、也不用在本地打开文件。

安装

dsh plugin --profile web add @cxxl/dsh-peek
# 装完重启一次(bundle 层只在启动时读取)

本地开发用 tarball 通道(不要 add 本地目录:junction 悬空陷阱):

cd plugins/dsh-peek
npm pack                                   # 产出 cxxl-dsh-peek-0.5.3.tgz
dsh plugin --profile web add ./cxxl-dsh-peek-0.5.3.tgz

使用

  1. 让 DSH 生成一些文件(write / edit 产出 HTML、SVG、Markdown、图片等)。
  2. 每轮结束后,在对话流底部会出现一行**「预览」chips**(列出本轮成功产出的文件,与官方产物 chips 并存)。
  3. 点击「预览」chips、官方产物 chips、行内文件提及或工具卡片(read/write/edit)里的文件路径 → 页面内弹出预览面板(官方覆盖层):标题栏显示文件名与大小,✕ / 点击遮罩关闭。
  4. 预览以浮层呈现,不设独立「预览」视图——与官方产品语言一致。

支持格式(声明制)

支持的格式在 Host 的 EXT_KIND 表中显式声明,每个扩展名对应一种确定的预览策略;未声明的格式一律提示「暂不支持该文件格式预览」,不渲染也不下载(例如 .rtf、音频/视频、Office 文档、其它二进制)。新增格式 = Host 登记一行 + 客户端加对应渲染分支。

| 格式 | 预览策略 | |---|---| | PNG / JPG / GIF / WebP / BMP / ICO / AVIF 等 | <img> | | SVG | <img>(惰性,脚本不执行,安全) | | HTML | sandbox iframe(脚本隔离,不能碰父页面) | | Markdown | 左右分屏:左原文 / 右官方 MarkdownText 预览(格式与聊天正文一致) | | 代码 / JSON / TXT / CSV / XML / YAML 等 | 官方 ReadBlock:行号 + shiki 语法高亮(IDEA 式文件视图) | | PDF | iframe | | 字体(woff / woff2 / ttf / otf 等) | 字符样本展示 |

架构

| 半 | 文件 | 职责 | |---|---|---| | Host | lib/index.js + lib/mime.js + lib/resolve.js | 入口注册 meta / file / styles.css 三个同源路由(公开 Service 契约);类型表(MIME + EXT_KIND 格式声明)与路径解析各自独立模块 | | Client | lib/client.js | 官方 Slot 席位:shell.overlay 预览面板 + conversation.chat.turnTail 链产物 chips;自注册 ConversationNodeDefinition(dsh-peek-produced)逐回合推导产物路径;点击接管为文档化约定偏差(官方 openFile 无接管钩子) |

Host↔Client 走同源 HTTP(与 dsh-terminal / dsh-sqlite / dsh-ui-restyle 同一套 webServer 机制),零运行时依赖。

  • GET /dsh-peek/meta?path=… → 文件名、大小、MIME、归类(image/svg/html/markdown/code/text/pdf/audio/video/other)。
  • GET /dsh-peek/file?path=… → 按正确 Content-Type 流式返回文件字节。

产物路径来源:回合内成功的 write / edit / 变更型 str_replace_editor 调用的 file_path(与官方 ui-deliverables 同款推导规则)。

权限与副作用

  • 文件读取:通过 node:fs 读取 DSH 进程可读的任意文件路径(等价于 dsh-terminal 在本地起 shell 的权限面);路由仅注册在 loopback 同源地址。
  • 网络:仅注册同源路由 /dsh-peek/meta、/dsh-peek/file 与 /dsh-peek/styles.css,不发起任何出站请求。
  • 点击接管(约定偏差):官方产物 chips、行内文件提及与工具卡片(read/write/edit)路径的点击被接管为内嵌预览(官方 openFile 无接管钩子;data-* 层经调研跨 20 个发布版零破坏)。插件停用时自动注销路由、样式与监听。
  • 插件停用时自动注销路由与样式、关闭面板。

已知限制(v1)

  • HTML 相对资源:HTML 用沙箱 iframe 内嵌渲染,自包含 HTML(内联 CSS/JS)可完整预览;引用外部相对资源 / 外链脚本的不保证。
  • Markdown 相对资源:md 里的相对图片路径不解析(渲染走官方 MarkdownText,格式保真)。
  • 单文件上限:内嵌预览约 512MB,超出提示改用下载。
  • 点击接管失效风险:若官方改动 chips / 工具卡片 / 行内提及的 DOM 结构导致接管失效,请回归本插件自有的「预览」chips(其点击不依赖宿主结构)。

依赖

零运行时依赖(只用 Node 内置能力 + harness 宿主服务 webServer),不 import 任何 harness 包。