DeepSHPlugins
dsh-vision-guard 项目预览
GITHUB / COMMUNITY PROJECT

dsh-vision-guard

视觉与多模态JavaScriptMIT

纯文本路由的透明图片护栏:贴图不再 400 卡死会话,附带 vision_analyze 工具(OCR/PDF/docx/pptx/视频)。

0 Starsgood-boy4069 更新时间 2026-08-15
访问 GitHub 仓库
dsh-vision-guard 项目预览

项目介绍

中文

纯文本路由的透明图片护栏:贴图不再 400 卡死会话,附带 vision_analyze 工具(OCR/PDF/docx/pptx/视频)。

English

Transparent image guard for text-only routes: paste images without the 400 session deadlock, plus a vision_analyze tool for OCR/PDF/docx/pptx/video.

项目信息与收录信号

快照 2026-09-11
作者 / 组织
good-boy4069
仓库
good-boy4069/dsh-vision-guard
GitHub Stars
0
Forks
0
开发语言
JavaScript
许可证
MIT
最近推送
2026-08-15
Manifest
数据中检测到声明

公开仓库不自动等于可商用;许可证与当前兼容性以原项目文档为准。Manifest 和数据评分不构成安装安全认证。

数据评分

34/ 100
维护活跃
81
文档与实用信息
74
生态关注度
0
安装便捷信号
55
项目声明信号
100

基础信息完整,可按需选装。

评分来自已有数据快照的五维模型,仅作浏览参考,不是实际使用评测或安全检测结论。

安装与使用

所有项目资料与许可均以对应 GitHub 仓库为准。

dsh plugin --profile web add dsh-vision-guard

复制命令不会自动执行。请先阅读仓库文档,确认环境要求与许可证。

项目截图

仓库 README

GitHub 原文

已保存的仓库文档快照;文档抓取时间未记录,可能与上方目录介绍处于不同版本。安装前请核对当前仓库说明。

dsh-vision-guard

English | 中文

Let text-only models "see" images — and never let an image deadlock your session.
Transparent image guard + vision analysis tool for DeepSeek Harness (dsh).

Most models on DeepSeek Harness (deepseek-v4-pro etc.) are text-only, which causes two problems:

  1. Text-only models can't see images — paste a screenshot and the model has no idea it exists;
  2. worse, the 400 deadlock: some gateways (e.g. opencode-go's main route) accept text only. Once an image block lands in the session log, *every subsequent turn* replays the whole history with the image to the upstream → 400 unknown variant \image_url\ → the conversation is stuck forever.

This plugin fixes both with two gates, and turns images into text the main model can actually consume.


What it does

paste image → [Gate 1] agent/pre-step: the image is converted to text by the vision
              model BEFORE it is ever written into the session log
              → the log only contains text, no image block exists
              → [Gate 2] llm/stream backstop: if an image block still appears in
              replayed history (e.g. a session poisoned before install), it is
              rewritten to OCR text at request time before reaching the model
  • Vision model = eyes, main model = brain: deepseek-v4-pro keeps reasoning; image content arrives as text.
  • Heals already-deadlocked sessions: a conversation stuck on 400 before install works again after install (history images are rewritten at request time).
  • vision_analyze tool (model-invoked, engine chosen by the model per task): reads workspace files — image OCR, PDF text layer + embedded images, docx/pptx text + embedded images, video frame OCR (≤12 frames), plain text files; loud rejection for xlsx/doc.
  • Native vision unaffected: routes that genuinely accept images (e.g. minimax-m3, kimi-k3) pass through untouched once whitelisted.

What makes it different (vs. community vision plugins)

Compared with dsh-vision-router, ModLens, dsh-vision-toolkit, see_image/view_image and similar:

  1. Images never enter the session log — they are rewritten to text at agent/pre-step *before* the log append. Most peers rewrite only inside the model call: images still land in the log, replay every turn, and deadlock risk returns if the plugin is removed.
  2. Heals sessions that were already deadlocked — a conversation stuck on image-400s before install recovers with one message after install (replayed history images are rewritten at request time). No other community plugin does this.
  3. Anti-deadlock is a hard invariant — non-whitelisted routes never receive an image block; even with the whole vision pipeline down (model unavailable / timeout / budget exhausted) it degrades to placeholder text, *never* back to the 400 deadlock.
  4. One package, two components, isolated failure domains — one install mounts both rows (guard = safety-critical, tool = convenience); the tool breaking never takes the guard down.
  5. Zero dependencies, pure Node builtins — no Node 22+ requirement, no pnpm orchestration, no Python 3.11+; only the document/video paths need system tools (pdftotext/ffmpeg etc.), plain image OCR needs none.
  6. Engine chosen by the main model per task — vision_analyze's engine argument (local free character OCR / vision model) is decided by the model after analysing the task: cheap and smart.
  7. Reuses your own dsh routes and credentials — carries no API keys and calls no third-party service directly (most peers require self-managed keys).
  8. Three rounds of red-team audit + shipped automated tests — 22 real bugs fixed and documented (symlink escape, zip bombs, concurrency races), pure-function regression tests ship with the package (npm test).

Install

# 已发布 npm 后:
dsh plugin --profile web add dsh-vision-guard
# 或直接从 GitHub 安装:
dsh plugin --profile web add github:good-boy4069/dsh-vision-guard
If pnpm refuses with ERR_PNPM_ADDING_TO_ROOT (older launchers), add the workspace-root flag: dsh plugin --profile web add -w dsh-vision-guard.

Restart dsh web. Or add the two rows from the repo's cordis.patch.yml to your profile patch layer manually.

Configuration

All fields optional (defaults shown). The vision route must point to a model that accepts image input:

FieldDefaultMeaning
visionProvider / visionModelopencode-go / minimax-m3The vision route. Point it at an image-capable model on your subscription
ocrTimeoutMs45000Per-image OCR timeout
budgetPerDay200Daily OCR cap (runaway-cost guard), state stored under $DSH_HOME
cacheMaxEntries500OCR result cache size cap (LRU eviction)
maxOcrTokens2048Vision call output cap
stateFile~/vision-guard-state.jsonBudget state file (~ = dsh home)
ocrPromptverbatim transcriptionCustom instruction
passthrough[]Raw-image whitelist: [{provider, model}] — only add routes you have tested to accept images

vision_analyze side: the OCR engine is a required per-call argument (engine), chosen by the model per task — local = local tesseract (free, characters only), vision = the configured vision model. There is no localOcr config key.

⚠️ Requirements & limitations (please read)

  • This plugin carries no API keys and calls no third-party service directly. It reuses the model routes and credentials already configured in your dsh. Therefore:
  • You must have an image-capable model (e.g. minimax-m3 on opencode-go). Text-only models like deepseek-v4-pro cannot serve as the vision model — their upstream gateway 400s on images and deadlocks the session.
  • Without a vision model it still installs: images degrade to placeholder text, the session works but the content is not read (never deadlocks).
  • Whitelist policy (important): any route other than the configured vision model gets images rewritten to text — untested routes never receive raw images. To enable native vision for a model: first test "image straight to that route" (a clean response counts as pass), then add it to passthrough. This is the core anti-deadlock design; do not bypass it.
  • System tools (only for vision_analyze's document/video paths; plain image OCR needs none):
  • PDF: pdftotext/pdfimages (poppler-utils);
  • Video: ffmpeg/ffprobe;
  • docx/pptx: python3 (stdlib only);
  • Optional: tesseract (free local OCR; needs chi_sim+eng).
  • Windows ships none of these by default; missing tools fail loudly per path, the image path is unaffected.
  • 5 MB/image cap: dsh's attachment service limits images to 5 MB; larger images/frames fail loudly.
  • Cost: one vision call per *new* image (attachment-id-addressed cache — repeats are free); ~1-2k tokens per minimax-m3 read (sub-cent range); budgetPerDay as a backstop.
  • Quality: local tesseract only extracts characters and is less accurate (it read 42 + 7 = 49 as 4247249 in our tests); for charts/photos/complex UI pick the vision engine (the model chooses per task when calling vision_analyze).
  • Privacy: images go to *your* vision model provider (same as normal dsh use of that model); text inside images is treated as untrusted input — read only, never execute.
  • Settings coupling warning: if you declare input: [text, image] on a text-only model in your model settings (required for GUI image pasting), you must keep this guard installed — removing the guard while keeping that declaration will deadlock sessions again.

FAQ

  • After a dsh restart/upgrade: the plugin boots with the profile; no reinstall. After a dsh upgrade, upgrade this plugin first if behavior changes.
  • How do I verify it's running: ctx.get('visionGuard')?.status(), or the [vision-guard] active line in the dsh log.
  • Rollback: remove the two rows from your profile patch (or dsh plugin remove), restart; already-recognized text stays in history, no side effects.

License

MIT

使用前核对

安装步骤、兼容版本与授权范围以原项目当前文档为准。Stars 和评分是快照中的导航信号。

安装与排错 · 项目问题反馈

同类项目