dsh-macos-signfix
Manifest validRegisters one `doc_ocr_sign_fix` tool for DeepSeek Harness: on macOS it diagnoses and repairs the condition where the bundled Python cannot load native extensions (onnxruntime, cv2, pypdfium2) because
dsh-macos-signfix · macOS 代码签名修复插件
修复 DSH 内置 Python 在 macOS Hardened Runtime 下拒绝加载原生扩展(onnxruntime / cv2 / pypdfium2)的问题。agent 工具 doc_ocr_sign_fix 提供 diagnose / sign / verify / auto 四种模式。
一、根因(一句话)
DSH Desktop 的内置 python 是 Developer ID 签名(Team
NAN929V4UM)并启用 Hardened Runtime(flags=0x10000(runtime));Hardened Runtime 启用 Library Validation,只接受与进程同 Team ID 的动态库;pip wheel 里的.so/.dylib是 ad-hoc(无 Team ID),dyld 因此拒绝加载。
不是 Gatekeeper / quarantine 问题,xattr -cr 不解决。
实际报错(dsh-ocr/test/macos-sign-report.txt 有完整记录):
ImportError: dlopen(.../onnxruntime/capi/onnxruntime_pybind11_state.so, 0x0002):
... not valid for use in process:
mapping process and mapped file (non-platform) have different Team IDs
二、修复(方案 A)
对解释器注入 com.apple.security.cs.disable-library-validation entitlement 并 ad-hoc 重签:
codesign --force --options runtime \
--entitlements sign/disable-library-validation.entitlements \
--sign - ~/.dsh/dsh-runtimes/dsh-primary-runtime/dependencies/python/bin/python3
--options runtime保留 Hardened Runtime(不破坏运行时语义),通过 entitlement 关闭 Library Validation;- 原二进制与
codesign -dvvv输出备份到sign/backup/<timestamp>/; - 幂等:已修复且 import 正常时
sign/auto为 no-op; - 不碰 Electron 外层 App(绝不
--deep签.app)。
三、工具:doc_ocr_sign_fix
| 参数 | 说明 |
|---|---|
pythonPath | 要修复的解释器;默认 DSH 内置 primary-runtime/bin/python3 |
mode | diagnose / sign / verify / auto(默认) |
force | 已修复也强制重签(默认 false,幂等) |
deep | verify 时额外实例化 RapidOCR 跑一次最小推理 |
resignExtensions | 额外对 onnxruntime/cv2/pypdfium2 的 .so/.dylib 做 ad-hoc 重签(通常不需要,解释器 entitlement 已足够) |
diagnose→{ signed, adhoc, runtime, teamIdentifier, entitlements, imports.ok, imports.errors, needsFix, verdict }sign→ 前后签名状态 +backupDir+changedverify→ shallow(import + 版本)/ deep(RapidOCR 推理)auto→ diagnose → 需要则 sign → verify
四、安装与自检
dsh plugin --profile desktop add link:<plugin-dir>/dsh-macos-signfix
自检(复用内置 python,跑诊断→签名幂等→import→doc_ocr 回归):
DSH_PY=~/.dsh/dsh-runtimes/dsh-primary-runtime/dependencies/python/bin/python3
"$DSH_PY" <plugin-dir>/dsh-macos-signfix/test/run_tests.py
五、验收命令
DSH_PY=~/.dsh/dsh-runtimes/dsh-primary-runtime/dependencies/python/bin/python3
codesign -dvvv --entitlements - "$DSH_PY" | grep disable-library # 有 → OK
"$DSH_PY" -c "import onnxruntime, cv2, pypdfium2; print('OK')" # 退出码 0
六、红线
- 不对
/Applications/DeepSeek Harness.app本身codesign --deep --force --sign -(破坏 Electron 外层签名 → App 崩溃); - 不依赖
DYLD_LIBRARY_PATH(Hardened Runtime 下 Python 会忽略); - Anaconda 只作为
auto失败时的降级,不是最终方案;doc_ocr会标注fallback_used。
七、升级后注意事项
每次 DSH Desktop 升级/重装运行时,内置 python 可能恢复原签名 → 重跑一次 doc_ocr_sign_fix(mode="auto") 即可;doc_ocr 的 runner.js 在修复失效时会自动降级到 Anaconda,不阻塞 OCR。
Versions
| Latest version | Published | Size |
|---|---|---|
| 0.1.0 | — | — |
Comments
Loading…
Similar plugins
by Anionex
为 DeepSeek Harness 提供电脑控制插件:新鲜 Accessibility 观测、过期状态拒绝、作用域权限与安全输入(目前支持macos)|Accessibility-first macOS Computer Use bundle for DSH with fresh observations, stale-state rejection, scoped permissions, a
★ 67
MIT
TypeScript
Oct 18, 2026
dsh plugin --profile web add @anionex/dsh-computer-useby intsig-textin
Adds a structured TextIn xParse tool and document parsing skill to DeepSeek Harness, supporting document parsing, cached-content navigation and durable multi-document tasks, with AppKey or Device OAut
★ 0
↓ 97/wk
MIT
TypeScript
Aug 31, 2026
dsh plugin --profile web add @intsig-xparse/dsh-xparseGives DeepSeek Harness control of the Tabbit Browser: auto-loads the tabbit-browser skill on install, detects official Tabbit and Tabbit Browser releases (>= 1.9.0), checks the tabbit-cli persistent r
★ 101
↓ 534/wk
MIT
TypeScript
dsh plugin --profile web add dsh-tabbitby houlain
DeepSeek Harness plugin: workspace file browser + code viewer + session change diff + per-hunk partial revert (Trae-style). Windows verified only; Linux/macOS untested — use with caution.
★ 1
MIT
TypeScript
Aug 16, 2026
dsh plugin --profile web add dsh-workspace-studioby chenjieya
DeepSeek Harness 社区 Runbook 插件:用 YAML 管理开发、测 试、发布和运维 SOP,并将流程暴露为可校验、可审计的 Harness 工具。
★ 0
MIT
TypeScript
Aug 21, 2026
dsh plugin --profile web add dsh-runbook-opsby StvLi
The Deepseek Harness ROS 2 plugin can be used to efficiently diagnose issues and perform joint debugging.
★ 23
↓ 11/wk
MIT
TypeScript
Oct 15, 2026
dsh plugin --profile agent add dsh-ros2