dsh-local-ocr
by littlewrite
DeepSeek Harness本地OCR插件,由macOS Vision和Windows Media OCR驱动。
An on-demand local OCR plugin for DeepSeek Harness, powered by macOS Vision and Windows Media OCR.
安装
dsh plugin --profile web add github:littlewrite/dsh-local-ocrGitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试
安装与环境配置指引、插件开发教程见 DSH 中文社区文档 ↗
安装即在你的机器上以你的权限运行第三方代码——它可读写文件、使用凭据、访问网络,DSH 的工具审批不会为插件代码加沙箱。「检测到 manifest」仅代表发现 dsh.bundle / dsh.plugin 清单,不构成兼容性或安全审查;安装前请审阅源码,不熟悉的插件先在不含密钥的环境试用。
README
一个独立的本地 OCR library 和 DeepSeek Harness 工具插件,面向 macOS 和 Windows。它不会修改 deepseek-harness,不负责缓存,也不决定什么时候应该调用 OCR。
底层适配器使用开源的 @napi-rs/system-ocr,通过统一的 Node.js API 调用 macOS 系统 OCR 和 Windows Media OCR。其 native 实现参考了 win-ocr-rs 和 mac-system-ocr。
安装
要求:Node.js 20 或更高版本、pnpm,以及已经安装并可执行的 DeepSeek Harness dsh 命令。
直接从 GitHub 将插件安装到 Web profile:
npx -y github:littlewrite/dsh-local-ocr install
安装器会把 bundle 加入指定的 Harness profile。安装完成后重启 dsh web。指定其他 profile:
npx -y github:littlewrite/dsh-local-ocr install --profile web
卸载:
npx -y github:littlewrite/dsh-local-ocr uninstall --profile web
如果要进行本地开发,可以克隆仓库并安装依赖:
git clone https://github.com/littlewrite/dsh-local-ocr.git
cd dsh-local-ocr
pnpm install
当前 native 依赖支持 macOS 和 Windows。Linux 暂不属于本 MVP 的支持范围。
DeepSeek Harness 插件
bundle 会加载 dsh-plugin/index.js。它注册一个面向模型的工具 local_ocr_image,但不会在 Harness 启动时加载 native OCR addon;只有模型真正调用工具时才会加载。
然后从 Harness 仓库正常启动:
cd /path/to/deepseek-harness
pnpm dsh web
从源码 checkout 加载插件时,默认要求 Harness 仓库是当前工作目录。如果由其他 launcher 或打包后的 Harness 加载,可以设置 DSH_HARNESS_ROOT 指向 Harness 安装目录。
让 agent 使用绝对路径调用 OCR:
请调用 local_ocr_image 工具,不要调用 read_image。
读取:
/absolute/path/to/image.png
Library API
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,
})
返回值只包含稳定字段:
{
"text": "recognized text",
"confidence": 0.8,
"engine": "darwin-system-ocr",
"durationMs": 12
}
图片中没有可识别文字时,返回空的 text 和 confidence: 0。如果需要保留 native 的无文字错误,可以设置 emptyWhenNoText: false。
开发
pnpm test
测试使用 fake engine 注入,不要求当前机器具备 OCR runtime。native smoke test 需要分别在支持的操作系统上运行。
原始 README: https://github.com/littlewrite/dsh-local-ocr/blob/main/README.zh-CN.md ↗
同类插件
查看全部 →
modlens
为纯文本模型架起视觉桥梁:粘贴图片,输出结构化 JSON 证据(OCR、版面、语义)。

dsh-vision-toolkit
让纯文本模型更好地做视觉任务:带意图的图片问答、长截图 OCR、UI 还原等。

dsh-vision-router
为纯文本 Agent 提供视觉能力:内置免 Key 视觉链 + 像素级视觉工具(看图问答、定位、裁剪、像素对比、取色、OCR、矢量化、抠图、截图);粘贴图片即可用。

dsh-vision-complete
给 DeepSeek 补上「眼睛和耳朵」的多模态视觉插件:看图 / OCR / 物体检测 / 视频理解 / 语音转写 / 截图直读,一键安装(DSH 插件)。

dsh-media-skills
面向纯文本模型的免费视觉桥与生图:粘贴读图、GLM-4V-Flash 与 Gemini 引擎故障转移、modlens 同款结构化证据输出,并自动播种免费视觉模型路由。

dsh-vision-opencode
给纯文本主模型加可配置识图模型:vision_read_image 工具、输入框识图模型选择器,以及纯文本路由的图片自动转文字。