Introduction¶
DeepSeek Harness (DSH) uses a plugin-based architecture, allowing developers to extend functionality without modifying core source code. When building agents, processing local image content is a common requirement. dsh-local-ocr is a standalone local OCR library and DSH tool plugin that provides a text recognition solution based on native system capabilities.
Plugin Introduction¶
This plugin is maintained by littlewrite. It uses the @napi-rs/system-ocr adapter to wrap the macOS Vision framework and Windows Media OCR into a unified Node.js API. The plugin exists as a Bundle, is loaded on demand, does not maintain a cache, and does not determine when OCR runs.
Installation and Activation¶
Before installing, ensure that your environment meets the following requirements:
* Node.js 20 or later
* pnpm is installed
* The DeepSeek Harness dsh command is installed
Use the official installation command to add the plugin to the Web profile:
npx -y github:littlewrite/dsh-local-ocr install
To specify a profile, add the --profile web parameter. After installation is complete, restart dsh web to activate the plugin.
Core Features¶
- Local engine: Calls native system OCR capabilities without requiring image uploads.
- On-demand loading: The native plugin is loaded only when the model invokes the tool, so it does not affect startup speed.
- Source integrity: Does not modify deepseek-harness source code; injected only through a Cordis patch.
- Unified interface: Provides a cross-platform Node.js API through
@napi-rs/system-ocr.
Typical Usage¶
The plugin registers a tool named local_ocr_image. When the Agent invokes this tool, it must pass an absolute local image path.
For developers, the provided library API can be used directly:
import { createOcrService } from './src/ocr.js'
const ocr = createOcrService()
const result = await ocr.recognize({
path: '/tmp/image.png',
languages: ['zh-cn', 'en-US'],
mode: 'accurate',
signal,
})
The return value contains the following stable fields:
{
"text": "recognized text",
"confidence": 0.8,
"engine": "darwin-system-ocr",
"durationMs": 12
}
When the image contains no text, it returns text: "" and confidence: 0.
Notes¶
- System support: Supports macOS and Windows only; Linux is not supported.
- Path requirement: The image path must be an absolute path.
- Execution context: The plugin runs with the permissions of the current DSH process. Review the source code and license before installation.