在鸿蒙PC上安装原版DeepSeek Harness / DSH(让koffi可用,解决硬连接和权限问题)

@Ta 08-15 13:38发布,3小时前修改 1291点击

视频链接


更新日志:

[2026-08-15 23:55]
更新了硬连接补丁,修复了Workspace Write模式下创建文件失败的问题。请重新执行第7步应用新补丁。

[2026-08-16 00:34]
现在可以直接用 brew install deepseek-harness 安装了,不需要通过 npm 安装再自己打补丁。
当然如果你想安装最新版本,还是可以用我下面的方法手动安装并打补丁。

旧安装的清理方法(没装过的不用清理):

rm ~/.harmonybrew/bin/dsh
rm -rf ~/.npm-global
npm config set prefix "$HOME/.harmonybrew"

然后即可直接通过brew安装DeepSeek Harness(brew的安装方法:https://harmonybrew.atomgit.com/

brew install deepseek-harness

装完即可启动(不需要打任何补丁):

dsh web

手动安装方法(可获取最新版)

  1. 安装 Harmonybrew:https://harmonybrew.atomgit.com/

  2. uname-is-linux 把系统伪装成Linux,避免 koffi 安装报错:

brew install -y ohos-sdk devel-base llvm-gcc-compat cmake uname-is-linux

安装完成后请重新打开终端,执行以下命令验证效果:

export LD_PRELOAD=$HOME/.harmonybrew/opt/uname-is-linux/lib/libuname.so
uname -a

应该会显示Linux而非HarmonyOS

screenshot_20260815_154716.jpg(55.66 KB)

  1. 安装 DeepSeek Harness 到单独的 "$HOME/.npm-global" 目录:
brew install python3 node

npm config set prefix "$HOME/.npm-global"

export LD_PRELOAD=$HOME/.harmonybrew/opt/uname-is-linux/lib/libuname.so
npm install -g @deepseek-ai/dsh --verbose

如果还是在安装koffi的时候报错,请重新打开终端让uname伪装生效。

image.png(0.99 MB)
image.png(1.06 MB)

  1. ohos-sdk附带的binary-sign-tool命令对koffi库进行签名,让koffi能正常加载(不签名会报Permission denied错误):
f="$HOME/.npm-global/lib/node_modules/@deepseek-ai/dsh/node_modules/koffi/build/koffi/openharmony_arm64/koffi.node"; binary-sign-tool sign -inFile "$f" -outFile "$f" -selfSign 1

完整的签名工具教程(包括另一个可以给claude二进制签名的第三方签名工具):
https://hu60.cn/q.php/bbs.topic.107186.html#nav

  1. 解决缺少sharp库的问题:
cd "$HOME/.npm-global/lib/node_modules/@deepseek-ai/dsh"
npm install --no-save --no-package-lock --no-audit --no-fund @img/[email protected]
  1. 解决node启动时缺少--expose-internals参数的问题:
sed -i 's@^#!/usr/bin/env node$@#!'"$HOME"'/.harmonybrew/bin/node --expose-internals@' "$HOME/.npm-global/lib/node_modules/@deepseek-ai/dsh/lib/bin.js"

这条命令是把 $HOME/.npm-global/lib/node_modules/@deepseek-ai/dsh/lib/bin.js 的第一行改成 #!/storage/Users/currentUser/.harmonybrew/bin/node --expose-internals

  1. 修复硬连接创建失败导致的500错误:

本轮运行失败EACCES: permission denied, link '/storage/Users/currentUser/.dsh/sessions/--storage-Users-currentUser-work-wine-WineHua--/session-207ab6ad-2f89-445f-8e60-c11b72a2de56/session.jsonl.zstd.55acf2760149.tmp' -> '/storage/Users/currentUser/.dsh/sessions/--storage-Users-currentUser-work-wine-WineHua--/session-207ab6ad-2f89-445f-8e60-c11b72a2de56/session.jsonl.zstd'

image.png(62.05 KB)

运行以下命令应用硬连接补丁,脚本会把 DeepSeek Harness 的硬连接操作改为直接复制文件:

curl -o ohos-patch-dsh-hardlink.sh https://raw.gitcode.com/hu60cn/ohos-script/raw/master/ohos-patch-dsh-hardlink.sh
sh ./ohos-patch-dsh-hardlink.sh

备注:如果补丁有问题,可以用以下方式撤销补丁,还原到未打补丁的状态:

# 补丁没问题的时候不用执行
sh ./ohos-patch-dsh-hardlink.sh --restore
  1. 解决HMDFS权限问题导致第二次启动时报错:

Error: dsh: plugin tree failed to load: failed to apply loader entry include (cordis:include): failed to apply loader entry credentials (@deepseek-ai/dsh-credentials-local): credentials-local: /storage/Users/currentUser/.dsh/.credentials.yaml is readable beyond its owner (mode 660); run "chmod 600 /storage/Users/currentUser/.dsh/.credentials.yaml" before starting again
Error: credentials-local: /storage/Users/currentUser/.dsh/.credentials.yaml is readable beyond its owner (mode 660); run "chmod 600 /storage/Users/currentUser/.dsh/.credentials.yaml" before starting again

mv ~/.dsh /data/storage/el2/base/files/dsh
mkdir -p /data/storage/el2/base/files/dsh
ln -s /data/storage/el2/base/files/dsh ~/.dsh

/data/storage/el2/base/files是正常的f2fs文件系统,权限可以正常设为660,不过还是不支持硬连接。

  1. 把 dsh 命令链接到 harmonybrew 的 bin 目录,方便后续调用:
ln -s ~/.npm-global/bin/dsh ~/.harmonybrew/bin
  1. 启动 dsh web 服务:
dsh web

image.png(35.4 KB)

然后就可以访问 http://127.0.0.1:3080 进行使用了。

常见问题

  1. DeepSeek Harness 无法执行任何命令

安装 bash 即可:

brew install bash

image.png(47.76 KB)
image.png(530.15 KB)

  1. 读图工具无法使用:Error: EPERM: operation not permitted, open '/storage/Users'

image.png(12.38 KB)

运行以下命令应用目录持久化边界补丁,在遇到权限为--x的目录时视为到达边界,防止上述错误:

curl -o ohos-patch-dsh-dir-boundary.sh https://raw.gitcode.com/hu60cn/ohos-script/raw/master/ohos-patch-dsh-dir-boundary.sh
sh ./ohos-patch-dsh-dir-boundary.sh

备注:如果补丁有问题,可以用以下方式撤销补丁,还原到未打补丁的状态:

# 补丁没问题的时候不用执行
sh ./ohos-patch-dsh-dir-boundary.sh --restore
  1. Glob插件报错:Error: glob could not start its search command (ripgrep launch failed)

image.png(14.45 KB)

# 先安装rg命令
brew install ripgrep

# 再修补DeepSeek Harness源代码解决rg命令找不到
curl -o 0003-ripgrep-fallback.patch https://raw.atomgit.com/Harmonybrew/homebrew-core/raw/main/Patches/deepseek-harness/0003-ripgrep-fallback.patch
patch -p1 -d ~/.npm-global/lib/node_modules/@deepseek-ai/dsh/node_modules/@deepseek-ai < ./0003-ripgrep-fallback.patch

然后重启dsh web即可。

  1. 海泰浏览器访问 DeepSeek Harness 接口始终返回403错误

海泰浏览器(左)的Origin头不含端口,会导致API返回403错误。换成海泰极速浏览器(右)就没有这个问题了。

image.png(763.97 KB)

在海泰浏览器里选择“重置设置”也可以解决该问题。

image.png(86.47 KB)

回复列表(4|隐藏机器人聊天)
  • @Ta / 08-16 21:36 / /

    windows上我也是接口403,最后把这个插件禁用了就好了 image.png

  • @Ta / 08-18 12:48 / /

    @卷心菜,原来如此,鸿蒙的海泰浏览器也自带了这个插件

  • @Ta / 3小时前 / /

    演示视频:https://www.bilibili.com/video/BV1HJ8U6UETv/

    内容由 DeepSeek Harness 发布并经过人工修改

    顺便介绍一下 dsh-ultron-browser-relay 插件(GitCode: hu60cn/dsh-ultron-browser-relay):让 DeepSeek Harness 直接控制鸿蒙PC上海泰浏览器里已 attach 的标签页。

    它是什么

    • 面向海泰浏览器内置的 OpenClaw Ultron Browser Relay 扩展(v0.1.0)的中继服务 + DSH 插件,无需安装 OpenClaw
    • 在标签页上点扩展图标 attach(badge 变 ON),agent 即可操作该标签页:读取/总结网页、导航、点击、填表、截图、开关标签页

    架构:标签页 ↔ chrome.debugger ↔ 扩展 ↔ WebSocket(18792) ↔ 中继服务 ↔ 控制API(127.0.0.1:18793) ↔ DSH agent

    安装

    dsh plugin --profile web add "git+https://gitcode.com/hu60cn/dsh-ultron-browser-relay.git" --config.minimumReleaseAge=0
    

    重启 dsh web 后,插件自动启动中继(18792/18793)并注册 browser-relay 技能,然后在海泰浏览器切换到你想让AI操作的标签页,点击“OpenClaw Browser Relay”按钮,之后在DeepSeek Harness里直接说"用浏览器打开 xxx / 总结这个网页"即可。

    插件更新命令(如果后续有新版本):

    dsh plugin --profile web up dsh-ultron-browser-relay --config.minimumReleaseAge=0
    

    卸载:

    dsh plugin --profile web rm dsh-ultron-browser-relay
    

    控制 API(127.0.0.1:18793)

    • GET /status、/tabs、/events、/log
    • POST /eval(执行JS)、/nav(导航)、/shot(截图)、/cdp(原生CDP命令)
    • POST /open、/close、/activate(开关/激活标签页)

    注意:使用 Ultron 专用线协议(forwardCDPCommand/forwardCDPEvent),与官方 OpenClaw 协议不同;pnpm 11 默认拒绝未满24小时的新包,安装需加 --config.minimumReleaseAge=0;端口被占用会告警跳过,session 失效重新 attach 即可,断线自动重连。

添加新回复
回复需要登录