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

@kiwifruit/dsh-jit-viewer

v1.0.1

Published

jit-viewer 的 dsh 插件适配:工具 preview_document + Web 预览浮层(client bundle)。第一版 PDF+Office/iframe 兜底。

Downloads

2,878

Readme

@kiwifruit/dsh-jit-viewer

DSH 平台插件 —— 在对话流中直接预览本机文档(PDF / Word / Excel / PPT / OFD / TXT / MD / CSV / HTML / 图片 / 视频),基于 jit-viewer SDK。

安装

dsh plugin --profile web add @kiwifruit/dsh-jit-viewer

本包声明 dsh.bundle.patchdsh.client.platform,安装后自动进入 bundle 层与 Web client 装载,重启 dsh web 生效

Model Experience(给模型的话)

当用户要求查看某个文档 / 文件,或你在了解上下文时需要打开某份文档时,调用 preview_document 工具来在界面中预览它,不要read / 文本类工具读取二进制文档(会报二进制错)。

  • 支持:pdfdocxdocxlsxxlspptxpptofdtxtmdmarkdowncsvhtmlhtmpngjpgjpeggifwebpsvgbmpmp4webm
  • 传入该文档的本地完整路径file);可选 filename 覆盖预览标题。
  • 若工具返回 ok:false(不支持类型 / 非法路径),直接告知用户"无法预览该文件",不要自行解析。
  • 预览由客户端打开浮窗渲染,你只需返回预览已触发的结果。

能力

  • 模型工具 preview_document:注册到工具表,schema 校验必填 file,返回规范 JSON。
  • 预览浮窗(Client bundle)preview_document 工具卡上的「预览」按钮 → 全屏浮窗,经宿主 HTTP 端点取文件并以 jit-viewer 渲染。随包内置 jit-viewer.min.js,离线可用。
  • 持久 Host↔Client 通道webServer exact 路由:
    • GET /api/jit-viewer/pending-preview —— 当前已准入的待预览目标,返回 { file, name, type, previewMode }
    • GET /api/jit-viewer/file?path= —— 从本地读取文件(带 safeServePath 校验:拒绝空 / NUL / .. 段),支持 Range 请求

配置

| 配置项 | 类型 | 默认 | 说明 | |---|---|---|---| | theme | "light" | "dark" | "light" | 客户端查看器默认主题 |

配置经 Config(schemastery schema)校验,非法配置 fail loud,插件不启动。

扩展点与依赖

  • 服务依赖:toolssystemPrompt(硬,inject 声明);webServer(可选,ctx.webServer 判空降级)。
  • Client slots:tool.call.toolview(key preview_document)、shell.overlay(id jit-viewer-preview)。
  • 运行依赖以 peerDependencies 声明(@deepseek-ai/cordis / dsh-client-runtime)。

命令

npm install
npm run typecheck       # tsc --noEmit
npm run build:host      # tsc emit → lib/index.js + lib/index.d.ts(ESM)
npm run build:client    # tsdown --config tsdown.client.config.ts → lib/client.js(CJS browser)
npm run build           # typecheck + build:host + build:client

发布检查

  • [x] 命名导出 name / inject / Config / apply
  • [x] main / types / exports 指向 lib/ 产物
  • [x] cordis.patch.yml 用 scoped 包名 insert
  • [x] files 只含运行入口 / 声明 / patch
  • [x] 注册全部可逆(经 ctx.effect

License

Apache-2.0