dsh-vision-router

621Stars25Forks3Issues0Watchers

Add visual capabilities

Language
JavaScript
License
MIT
Branch
main
deepseek-harnessdshdsh-pluginmultimodalvision

Install

$ dsh plugin --profile web add github:ysr666/dsh-vision-router

Run the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial

One-Line Pitch

dsh-vision-router is DeepSeek Harness's visual enhancement plugin: enabling Agents that originally could only chat with text to directly "see" images — after sending an image, the Agent can call 14 visual tools just like regular tools (positioning, cropping, pixel comparison, OCR, vectorization, background removal, HTML screenshot, etc.), while built-in with a registration-free, key-free anonymous visual chain fallback, with the entire pipeline not relying on Python.

Core Capabilities

  • Making image turns work like regular text turns: users paste images, the Agent answers by viewing via vision_describe, and can perform continuous multi-step operations (ground → crop → describe → pixel_diff)
  • Automatically mirroring existing model groups as "+ Auto Image Recognition" entry points, keeping original model groups unchanged, with hot updates when new models/scope changes
  • Built-in OVHcloud anonymous free visual chain fallback (5 Qwen/Mistral models), usable without filling any Key
  • Providing pixel-level visual tools: positioning, cropping, pixel-by-pixel comparison (difference rate + red heatmap), color picking, SVG vectorization, solid background removal
  • Visual answers cached by attachment content hash; subsequent text turns replace historical images with recorded descriptions, so DeepSeek "remembers" previously sent images without repeated visual calls
  • Automatic fault degradation chain: region restrictions/risk control/quota/rate limiting/context overflow/network failures, try each provider in sequence, 429 triggers circuit breaker cooldown

Technical Implementation

  • Language: JavaScript (ESM) / CommonJS client build
  • Key Dependencies: sharp (image processing), potrace (bitmap vectorization), puppeteer-core + system Chrome (HTML screenshots), undici (HTTP calls), @deepseek-ai/schemastery (config Schema)
  • Architecture Pattern: Cordis plugin + bundle patch self-mount, injects tools, llm; entry.js standardizes progressiveTools default values before calling core apply; client goes through dsh.client injection into dsh-client-ui-settings/dsh-client-runtime/dsh-client-connection/dsh-api-remotes
  • Entry Files: entry.js → index.js (core 7222 lines), client bundle entry lib/client.js; also exposes dsh-vision-router CLI (lib/doctor-cli.js) for diagnosis/repair

Use Cases

Suitable for users sending images to DeepSeek-style Agents in DSH Web: paste screenshots to let it see UI errors, attach reference images for page replication, paste product images for difference description, paste long chat screenshots for transcription. Users who need UI restoration can verify closed loops (design → HTML → vision_pixel_diff quantify differences → fix → compare again), or users who want to use local Ollama/LM Studio for offline sensitive image recognition can all benefit directly.

Prerequisites & Compatibility

DependencyMin VersionDescription
DSH>= 0.1.0-rc.6peer dependencies declare @deepseek-ai/dsh-anonymous-user-id and @deepseek-ai/dsh-llm-deepseek ^0.1.0-rc.6; requires --profile web during installation
Node.js>= 22engines.node declared
sharp>= 0.35.3 < 1peer dependency; pnpm onlyBuiltDependencies allows native compilation; residual 0.34.0 in profile conflicts with host 0.35.3 (DLL error)
System ToolsVaries by toolvision_html_screenshot requires Chrome/Chromium/Edge; vision_screenshot (macOS/Windows use system screenshot, Linux requires ImageMagick import or scrot); vision_ocr falls back to visual model when local tesseract is missing
PlatformmacOS / Windows / LinuxCore tools cross-platform; desktop screenshot tools vary by platform

Installation

dsh plugin --profile web add github:ysr666/dsh-vision-router

Configuration Options

ConfigTypeDescriptionDefault
providersarrayMulti-provider visual backend chain, tried in order; new users default to one built-in free vision-http[{"provider":"vision-http","model":"ovh/Qwen3.5-397B-A17B"}]
httpProvidersarrayOpenAI-compatible direct endpoints (Zhipu/Alibaba Bailian/Groq/OpenRouter, etc.), prioritized over built-in free chain[]
autoWrapProvidersbooleanAutomatically mirror enabled models as "+ Auto Image Recognition" group, hot update on model directory changestrue
wrappedProvidersarrayManual wrapping scope (used when auto-wrap is disabled or limited to certain models)[{provider:"deepseek-official",models:[]}]
routingbooleanLegacy full-turn chain routing (switch to visual model for entire turn at once); disabling goes to tool-first flow (recommended)false
stealthbooleanTake over official deepseek-official routing (official only); custom routing handled by auto-wrapfalse
progressiveToolsbooleanProgressive tool mounting (expand full 14 tools when first needed); default off to stabilize long-session prefix/KV cachefalse
structuredVisionBootstrapboolean1+x structured pre-recognition (establish task-independent evidence base image before subsequent visual calls)false
desktopScreenshotbooleanPrivacy toggle for vision_screenshot desktop screenshot toolfalse
freeFallbackbooleanAppend anonymous OVH free chain after explicit local/custom HTTP backendstrue
localOllamaobjectLocal Ollama visual backend (enable/disable, address, model name, OpenAI/Anthropic protocol, optional temperature/top_p){enabled:false,baseURL:"http://127.0.0.1:11434/v1",model:"qwen2.5vl",format:"openai"}
localLmStudioobjectLocal LM Studio visual backend (same as Ollama; model must be real identifier from Developer page or /v1/models response){enabled:false,baseURL:"http://localhost:1234/v1",model:"",format:"openai"}
instantDescribebooleanUse local backend to recognize uncached images before first model step in image turns (Ollama→LM Studio, fallback to static tool marker on failure)false
downscale / downscaleMaxPixelsboolean / numberAuto-compress oversized images before calls (latency protection)true / 4000000
cache / cacheTtlSeconds / cacheMaxEntriesboolean / numberVisual answer cachetrue / 3600 / 200
timeoutMsnumberSingle visual call timeout120000
proxy / proxyHostsstring / arrayOnly visual provider domains go through local proxy (DeepSeek stays direct)"" / 9 default domains like openrouter
artifactsDirstringArtifacts directory (relative to session workspace).dsh-vision-router/artifacts

FAQ

Q: Do I need additional configuration after installation?

A: No. The plugin comes with bundle patches and enables the built-in OVH anonymous free visual chain by default; after installation, simply switch to the model group with "+ Auto Image Recognition" in the bottom-right corner of the chat page to send images.

Q: Can I use it without an API Key?

A: Yes. The default chain includes 5 OVHcloud anonymous visual models, registration-free and key-free, 2 requests per minute per IP per model. When quota is insufficient, you can add a httpProviders entry with Key in the settings card (e.g., Zhipu's glm-4v-flash).

Q: Why does the chat say "Current model does not support images"?

A: The plugin does not modify original model groups. You need to switch to the group with "+ Auto Image Recognition" in the model selector at the bottom-right of the chat page to send images; sending images with the original pure-text group will be blocked by the host.

Q: Which platforms are supported?

A: Cross-platform. vision_screenshot uses system screenshot capabilities on macOS/Windows; Linux requires ImageMagick's import or scrot; vision_html_screenshot requires Chrome/Chromium/Edge; other tools work without a browser.

Q: What visual tools are available?

A: 13-14 tools mounted by default: vision_describe (image Q&A), vision_ground (pixel positioning), vision_detect (element list), vision_crop (cropping), vision_pixel_diff (pixel comparison + heatmap), vision_colors (color picking), vision_ocr (text transcription), vision_trace (SVG vectorization), vision_extract_foreground (background removal), vision_present (persistent image display), vision_materialize (attachment to disk), vision_html_screenshot (HTML screenshot), vision_long_screenshot_ocr (long screenshot transcription), plus vision_bootstrap structured pre-recognition; privacy-sensitive vision_screenshot is off by default, becomes 14th when enabled.

Q: Can it work purely offline locally?

A: Yes. After enabling localOllama.enabled or localLmStudio.enabled, local backends are prioritized at the front of the HTTP visual chain, automatically degrading on failure; combined with instantDescribe: true, local recognition can be completed before the first model step.

Q: After upgrade, DSH reports "duplicate loader entry id: vision-router"?

A: The profile directory's cordis.patch.yml retains manual insertion blocks from v0.x era, duplicating the plugin's bundle patches. Delete the entire insert: block, or rewrite it to override by id, then restart.

Q: How to uninstall?

A: Execute dsh plugin --profile web remove github:ysr666/dsh-vision-router; wrapped routes, tools, skills, and settings card will be removed together, generated artifact files are preserved.

Learning Curve

Beginner — default config works out of the box for sending images, zero-config start; advanced users can adjust visual backend chain, local backend, cache, proxy, and other parameters via settings card or profile patches.

Known Issues & Limitations

  • If the profile directory's package.json is saved as UTF-8 with BOM by some editors, dsh web will report Unexpected token ... is not valid JSON at startup; use the plugin's built-in npx dsh-vision-router repair --profile web to remove BOM
  • Residual sharp 0.34.0 in old profile conflicts with host 0.35.3 in same process DLL (issue #42/#75), pixel tools report colourspace: parameter space not set; v1.2.2+ proactively warns when detecting residue
  • Oh-DSH Desktop ≤ 0.1.5 has built-in DSH 0.1.0-rc.5, v1.4.1 and earlier causes that runtime to crash on startup (reports configurable provider "deepseek-official" is already declared); need v1.4.2+
  • When both dsh-web-ui / dsh-web-ui-all are installed, their dsh-tool-describe-image send hook may rewrite image blocks before this plugin; need to disable "Rewrite image to describe-image reference on send" in "Image Understanding" settings
  • pnpm v11 silently blocks versions released less than 24 hours, causing update to report downloaded 0 / added 0; need to explicitly add dsh-vision-router@<version> or run npx dsh-vision-router repair
  • vision_html_screenshot depends on system-installed Chrome/Chromium/Edge, reports error directly when not detected without auto-install
  • vision_ocr silently falls back to visual model when local engine (tesseract) is missing, OCR speed and quota counted as visual model
  • vision_screenshot is off by default; when enabled, macOS/Windows use system screenshot capability; Linux requires ImageMagick import or scrot and must be in a capturable desktop session (Wayland support depends on environment)