
Company News
Socket Joins New OpenJS Program to Fund Node.js Security Work
Socket is joining the OpenJS Security Stewardship Program to fund Node.js vulnerability research, maintainer remediation, and security releases.
dsh-plugin-image-tools
Advanced tools
DSH 图片插件:ask_user_choice 图片/图文混合选项(Web GUI 渲染图片选择卡,可放大查看)+ show_images 在回复中内嵌图片(图片与文字混排)。图片来源支持本地路径 / http(s) URL / base64 data URI。纯插件实现,不改核心包。
给 DeepSeek Harness Web GUI 增加图片能力的插件,三个工具覆盖三种场景:
| 工具 | 场景 | 效果 |
|---|---|---|
ask_user_choice | 模型让用户在选项里挑图 | Web GUI 渲染图片选择卡,可放大查看,答案协议与原生一致 |
show_images | 模型在回复正文里展示图片 | 图片与文字混排显示在聊天里,点击可放大 |
save_received_images | 用户发图给盲模型(无视觉输入的适配器) | 图片以文件形式保存到工作区,模型可下载/分析 |
图片来源统一支持三种:本地路径(相对会话工作区或绝对路径,含 ComfyUI 出图产物)、 http(s) URL(服务端拉取后转存)、base64 data URI。纯插件实现,不改核心包。

模型问「选一张封面」,每个选项带一张图,用户点卡片(或放大镜)即可选择。

模型在回复里调用 show_images,把返回的 markdown 片段粘贴进正文,图片就随文字一起显示。
两张效果图均为真实 Web GUI 截图(maid-atelier 皮肤)。
ask_user_choice(图片 / 图文混合选项):
path / url / data),纯图片、纯文字、图片+文字可同题混排;(Recommended) / (推荐));show_images(回复内嵌图片):
caption 说明;save_received_images(盲模型收图 → 文件):
agent/pre-step 监听器把消息里的 image 内容块重写为
文本占位符(dshimg:<attachmentId>)——文本-only 适配器(如 DeepSeek)不再
因图片块报 UNSUPPORTED_CONTENT,回合照常运行;/dsh-plugin-image-tools/attachment/<id> 路由出字节);save_received_images,把图片按 attachmentId 保存为
工作区文件(默认 received/),之后可用文件/命令工具分析(尺寸、像素、哈希等);image-<n>-<时间戳>.<ext> 生成。浏览器端消费 question/requested 帧时用 zod schema 严格解析,选项对象上的未知
字段会被剥离;助手消息 content 由模型文本生成,也没有携带结构化图片块的通道。
所以图片不能塞进 option / content 字段。本插件改为:
/dsh-plugin-image-tools/<pickId>/<index>(选择卡)、
/dsh-plugin-image-tools/show/<showId>/<index>(回复内嵌)与
/dsh-plugin-image-tools/attachment/<attachmentId>(盲模型收图回显)
直接提供字节(同源 <img src> 加载);detail(标准字符串字段,原样透传)开头写入不可见的
HTML 注释标记 <!--dsh-pick:v1:<base64url JSON>-->,携带 pickId 与带图选项下标;
客户端插件在 conversation.composer slot 链注册条目(priority 更小,优先于原生),
识别标记后渲染图片选择卡;无标记的问题交给原生 UI;show_images 返回绝对 URL(宿主 origin 由 ctx.webServer.host/port
推导),模型粘贴进正文,核心 markdown 渲染器原生显示;客户端再对
/dsh-plugin-image-tools/show/ 前缀的图片做渐进增强(MutationObserver 发现 +
单节点样式/事件注入,纯 DOM,不侵入 React 渲染树);agent/pre-step waterfall 监听器(与 agent-instructions /
time-context 同机制),把进入 LLM 步骤的消息批次里的 image 块重写为文本占位符
(登记附件 ref 到 TTL 注册表),会话日志/UI 因此保持纯文本安全;客户端增强器
在用户气泡文本里识别 dshimg:<id> 占位符并替换为可放大图片;save_received_images
经 ctx.attachments.readImage 取回附件字节落盘。详见 设计说明.md。
lib/index.js 服务端:三个工具注册 + pre-step 重写 + 图片/附件注册表 + web 路由(零运行时依赖)
lib/client.js 客户端:composer 链条目 + 图片选择 UI + 内嵌/收图图片增强(浏览器模块加载器格式,免构建)
scripts/selfcheck.mjs 纯函数自检(node scripts/selfcheck.mjs)
scripts/smoke-server.mjs 服务端集成冒烟(假 ctx 跑通工具→路由→pre-step 重写→落盘全链路)
scripts/smoke-client.mjs 客户端冒烟(真实 react 渲染选择卡 + 增强纯函数)
cordis.patch.yml bundle 补丁(挂载行)
docs/ 效果图(README 展示用)
# 1. 把插件 link 进 profile(已写入 package.json 时跳过这步的编辑)
cd C:\Users\18303\.dsh\profiles\web
pnpm install
# 2. 重启 dsh(launcher),然后刷新浏览器页面
profile 的 package.json 需要包含:
{
"dependencies": {
"dsh-plugin-image-tools": "link:D:/dsh/plugins/dsh-plugin-image-tools"
},
"dsh": {
"profile": {
"bundles": [ /* ... */, "dsh-plugin-image-tools" ]
}
}
}
dsh.profile.bundles 里的包会自动应用其自带 cordis.patch.yml 的挂载行
(与 dsh-notify 同机制)。
{
"questions": [
{
"id": "cover",
"question": "选一张封面图",
"header": "封面选择",
"options": [
{ "label": "深海鲸鱼 (Recommended)", "image": { "path": "novel/assets/covers/whale.png" } },
{ "label": "星空",
"image": { "url": "https://example.com/stars.png" } },
{ "label": "手绘风",
"image": { "data": "data:image/png;base64,iVBORw0KGgo..." } },
{ "label": "都不选,我自己说", "description": "选这个可以在下方输入自定义答案" }
],
"multi_select": false
}
]
}
// 返回:{ "answers": [ { "id": "cover", "selected": ["深海鲸鱼 (Recommended)"] } ] }
// 调用 show_images
{
"images": [
{ "image": { "path": "novel/assets/covers/whale.png" }, "caption": "深海鲸鱼封面" },
{ "image": { "url": "https://example.com/stars.png" }, "caption": "星空" }
]
}
// 返回:{ "markdown": ["", ""], "note": "..." }
模型把 markdown 数组里的片段原样逐行粘贴进回复正文,图片随文字显示:
这是为你生成的封面候选:

需要调整配色或构图可以告诉我。
http://host:port,由服务端监听配置推导);
若 GUI 经过反向代理/换端口访问,历史消息里的图片地址可能失效(同选择卡的限制)。MIT
FAQs
DSH 图片插件,三个工具覆盖三种场景:ask_user_choice 图片/图文混合选择卡(Web GUI 渲染,可放大查看)+ show_images 回复内嵌图片(图文混排)+ save_received_images 盲模型收图存为工作区文件;聊天栏所有图片点击放大,支持滚轮缩放与拖拽平移。来源支持本地路径 / http(s) URL / base64 data URI。零 token 本地渲染,纯插件实现不改核心包。
The npm package dsh-plugin-image-tools receives a total of 0 weekly downloads. As such, dsh-plugin-image-tools popularity was classified as not popular.
We found that dsh-plugin-image-tools demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Company News
Socket is joining the OpenJS Security Stewardship Program to fund Node.js vulnerability research, maintainer remediation, and security releases.

Security News
Two compromised GitHub Actions were re-enabled with malicious tags intact, exposing thousands of downstream repositories to Mini Shai-Hulud.

Research
/Security News
A malicious Firefox extension fetches its payload after installation to evade detection, steal Google session cookies, and automate account takeover.