Plugin directory / Developer / dsh-attachment-downscale
dsh-attachment-downscale
Verified · install-tested on dsh zoumutou
What it does
DSH 插件:图片附件超限自动降级(2000px / 3.5MB / 4000万像素)
Works — verified, early-stage project
DSH 插件:图片附件超限自动降级(2000px / 3.5MB / 4000万像素) It installs cleanly and boots without issues in our testing. It's early-stage but functional.
“Verified” means our automated CI actually ran dsh plugin add in a clean profile and it booted — nothing more. Feature descriptions and version compatibility are the author’s claims. This is not a security audit and not an endorsement of third-party code.
README
dsh-attachment-downscale
DSH 图片附件准入对超限图片(单边 >2000px / 单图 >3.5MB / 像素超 4000 万)直接拒绝,
上传手机原图时体验很差。本插件在 attachments 服务入口(saveImages)把超限图片
用 sharp 自动降级后再入库:
- 超尺寸 → 等比缩放到限制内(长边 ≤2000px)
- 缩放后仍超字节数 → 同格式降质(jpeg/webp 质量阶梯),仍不行转 webp
- 多帧动图(GIF/WebP)跳过不处理,避免破坏动画
- 处理失败 → 直通原准入逻辑(维持原拒绝行为),绝不吞错误
入库后图片恒满足准入限制,模型请求 / vision-bridge / 历史导出拿到的都是合规文件。
安装
# 本地开发
npm run build # 或 dev_build_plugin
# 装入 web profile(热生效,免重启):
# dev_install_package /Users/zoumutou/coded/dsh-attachment-downscale web
# 生产(npm 发布后)
dsh plugin --profile web add dsh-attachment-downscale
# 或 GitHub 装配
dsh plugin --profile web add github:zoumutou/dsh-attachment-downscale
市场上架
- npm 包带
dsh-plugin关键词,GitHub 仓库打dsh-plugin话题后,社区市场
(dsh-suite 每小时刷新 / chnjames dsh-plugin-market 实时查询)自动收录,无需 PR。 - Release 附件:
npm pack产出dsh-attachment-downscale-<version>.tgz。
配置
插件行支持 config:
- insert:
- name: dsh-attachment-downscale
config:
enabled: true # 关闭后恢复原拒绝行为
quality: 82 # 重编码质量(jpeg/webp)
# 以下缺省跟随 attachments 服务自身的准入限制:
# maxImageDimension: 2000
# maxImageBytes: 3670016
# maxImagePixels: 40000000
测试
node test/normalize.test.mjs
Install
Install the catalog once, then DeepSeek Harness can find and install any plugin from this site automatically:
dsh plugin add dshbase-catalog Then say "install dsh-attachment-downscale for me" — your agent finds it in the directory and installs it. Docs: dshbase-catalog · verified packs.
This plugin is GitHub source (not published to npm) — install it straight from the repo:
Web profile:
dsh plugin --profile web add github:zoumutou/dsh-attachment-downscale Headless (CLI) profile:
dsh plugin --profile headless add github:zoumutou/dsh-attachment-downscale Test report
Verified: L1 install + L2 load + L3 runtime from GitHub source on dsh 0.1.0-rc.6.