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

@jetecho/dsh-csv-and-image-preview

v0.1.3

Published

Preview images / SVG and CSV tables in the DeepSeek Harness chat, rendered as real browser <img> / <table> elements. Preview-first workflow: show the user the asset, wait for approval, then apply the real change.

Downloads

904

Readme

dsh-csv-and-image-preview

English | 中文

在 DeepSeek Harness 聊天中预览图片、SVG 和 CSV/TSV。图片使用原生 <img>,表格使用原生 <table>,支持粘性表头、320px 内部滚动和点击排序。

安装与升级

0.1.3 针对 DSH 0.1.5-rc.1 验证,使用新版 Connection RPC 接口。请使用该版本或兼容接口的更新版。

# 安装已发布版本
dsh plugin --profile web add @jetecho/dsh-csv-and-image-preview

# 从当前仓库打包并安装修复版(无需发布 npm)
npm ci
npm test
npm pack
dsh plugin --profile web add ./jetecho-dsh-csv-and-image-preview-0.1.3.tgz

安装后重启 dsh web 并刷新浏览器。包名、bundle 行 ID 和工具名均保持不变。

0.1.3:修正正文预览的实际挂载

0.1.3 使用独立的 conversation.chat.node 键控内容行,在 turn/end 之后显示预览,避开执行过程的折叠区间。原有文件卡片继续由 DSH 渲染。

图片、SVG、CSV 支持直接调用、run_code 嵌套调用和旧版 meta。刷新或重新打开会话后重放已保存的预览;仅调用 DSH present 而没有调用本插件的文件不在此功能范围内。

验证:npm test 使用真实 SlotCore 校验注册。设置 DSH_UPSTREAM 为 DSH 源码目录后,可额外使用真实 ConversationNodeAssembler 和 ChatSnapshotBuilder 检查增量事件与历史回放。npm run preview:test 提供浏览器验收页;同时设置 DSH_SESSION 为本机会话文件时,只读回放该会话及已有快照,不修改原会话文件。

兼容性修复

预览只注册 /api/csv-and-image-preview/get 精确路由,避免占用由 DSH 系统网关独享的 /api 拦截器,保证历史列表和插件列表正常加载。升级后重启 DSH 并刷新页面即可重新加载,修复不修改会话文件。

  • 前端声明 slots、connection 服务依赖,后端声明 tools、connection;服务稍晚就绪时会等待,卸载时清理注册。
  • 直接调用和 run_code 嵌套调用均可预览。 新版 DSH 不为嵌套调用生成 presentationMeta,因此本插件改用独立快照通道。
  • 工具只读取、解析一次输入,在返回成功之前保存快照。模型和 run_code 程序收到的仍是字符串摘要,不额外包含图片字节或表格正文。
  • 前端区分生成中、加载中、执行失败、快照缺失和图片解码失败,支持重试、连接恢复后重新读取,以及切换会话时取消过期请求。
  • 旧会话已有的 block.meta.src / block.meta.rows 继续显示。旧版嵌套调用如果从未保存展示数据,需重新调用预览工具。

使用

让 agent 调用工具,例如:

preview_image {"path":"D:/assets/logo.svg","label":"Logo 预览"}
preview_csv {"path":"D:/data/sales.csv","label":"销售数据","maxRows":100}
preview_csv {"content":"姓名,分数\n张三,90\n李四,85"}

内联 SVG 可直接传入 content。相对路径以当前会话工作目录为基准。path 与 content 同时存在时优先读取 path。

图片支持 SVG、PNG、JPEG、GIF、WebP、BMP、ICO、AVIF。内联非 SVG 内容使用标准 base64,同时指定 mime。图片和 CSV 输入均限制为 8 MiB;内联 base64 限制按编码后的输入大小计算。

CSV 文件必须为 UTF-8,支持 UTF-8 BOM;其他编码会明确提示转换,而不是输出乱码。自动识别逗号、分号、Tab、竖线,或用 delimiter 指定;.tsv 默认 Tab。默认显示前 50 行,最多 500 行(均含表头)、40 列,每个单元格最多保存 200 字符加省略号。悬停显示已保存的单元格内容,截断部分无法还原。点击表头循环升序、降序、原始顺序,空值始终沉底。

数据与历史预览

预览快照保存在 $DSH_HOME/storages/csv-and-image-preview/;未设置 DSH_HOME 时使用 ~/.dsh/storages/csv-and-image-preview/。每条记录按会话 ID、调用 ID 和工具名定位,路径采用哈希文件名。通过 DSH Connection 的已认证 /api RPC 通道读取,并核对记录身份。

刷新页面、重启 DSH 或修改/删除原文件后,同一会话仍显示生成时的快照。备份会话时应同时备份此目录。当前不自动清理快照;删除目录会让新版历史预览失效。复制/分叉成新会话时不自动迁移原会话的快照。

调用返回 预览数据已生成… 表示快照保存成功,不代表浏览器已解码显示。工具执行错误作为真正的失败交给 DSH,避免误报成功。

预览优先约定

生成或修改图片、SVG、CSV 时,先预览,用户认可后再修改目标文件;预览快照本身会写入插件数据目录。此约定由 agent 遵守,插件不阻止其他写文件工具。可将 Agent.md 的说明加入 agent 指令。

开发

npm ci
npm test              # Cordis / DSH 工具调度、持久化、React 组件回归
npm run preview:test  # 本地浏览器验收页,终端显示地址
npm run build         # lib/ 为可直接发布的 JavaScript
npm pack --dry-run    # 检查发布文件
  • lib/index.js:工具定义、输入读取与解析。
  • lib/store.js:原子快照写入、读取边界、认证通道处理函数。
  • lib/client.js:工具视图、RPC 读取、状态与重试、旧 meta 兼容。
  • cordis.patch.yml:标准 Profile Bundle 插入行。

MIT © jetecho.