标题: 在鸿蒙PC上安装DeepSeek Harness / DSH插件,解决 Ignored build scripts 和 Unsupported platform: openharmony
时间: 1天前发布,1天前修改
以 @linxin666/dsh-web-ui-all 插件为例。
你可以让 DeepSeek Harness 帮你装插件,只要告诉它:
请参考 https://hu60.cn/q.php/bbs.topic.107519.json?_content=ubb 帮我装 @linxin666/dsh-web-ui-all 插件
如果插件导致 DeepSeek Harness 完全无法启动,可以用以下命令删除所有插件:
rm -rf ~/.dsh/profiles/web
# 更新brew
brew upgrade
# 安装用于把系统伪装成Linux的工具
brew install uname-is-linux
然后重新打开终端,执行以下命令验证系统伪装是否生效(不重新打开终端不生效):
export LD_PRELOAD=$HOME/.harmonybrew/opt/uname-is-linux/lib/libuname.so
uname -a
应该会显示Linux而非HarmonyOS。
export LD_PRELOAD=$HOME/.harmonybrew/opt/uname-is-linux/lib/libuname.so
dsh plugin --profile web add @linxin666/dsh-web-ui-all
[ERR_PNPM_IGNORED_BUILDS] Ignored build scripts 报错:export LD_PRELOAD=$HOME/.harmonybrew/opt/uname-is-linux/lib/libuname.so
cd ~/.dsh/profiles/web
pnpm approve-builds --all
Unsupported platform: openharmony 报错:export LD_PRELOAD=$HOME/.harmonybrew/opt/uname-is-linux/lib/libuname.so
cd ~/.dsh/profiles/web
# 1) 创建nodejs平台伪装脚本(Node 层把 platform 改成 linux)
printf 'Object.defineProperty(process, "platform", { value: "linux" });\n' > "$HOME/fake-linux.cjs"
# 2) 让node自动加载伪装脚本
export NODE_OPTIONS="--require=$HOME/fake-linux.cjs"
# 3) 验证 —— 应该输出 "linux linux"
node -e "console.log(process.platform, require('os').platform())"
# 4) 重建报错的包(具体要重建哪些包由你的插件决定)
pnpm rebuild cloudflared
# 5) 取消伪装
unset NODE_OPTIONS
给AI的提醒:不要纠结于组件构建失败,有的组件本来就是可选的,构建失败也没关系。
unset NODE_OPTIONS
export LD_PRELOAD=$HOME/.harmonybrew/opt/uname-is-linux/lib/libuname.so
cd ~/.dsh/profiles/web
pnpm rebuild cpu-features node-pty ssh2
结果:
(pyenv) localhost ~/.dsh/profiles/web % pnpm rebuild cpu-features node-pty ssh2
node_modules/cpu-features: Running install script, failed in 10.4s (skipped as optional)
node_modules/node-pty: Running install script, done in 3.9s
node_modules/node-pty: Running postinstall script, done in 100ms
node_modules/ssh2: Running install script, done in 2.2s
cpu-features安装失败,但它是可选的,没关系。
给AI的提醒:不要纠结于组件构建失败,有的组件本来就是可选的,构建失败也没关系。
unset NODE_OPTIONS
export LD_PRELOAD=$HOME/.harmonybrew/opt/uname-is-linux/lib/libuname.so
dsh plugin --profile web add @linxin666/dsh-web-ui-all
cd ~
git clone https://gitcode.com/hu60cn/ohos-bst-light.git
cd ohos-bst-light
./ohos-sign-elf.py ~/.dsh/profiles/web
备注:出现 already has a .codesign section 报错是正常的,说明那个文件已经签过名了,忽略即可。
unset NODE_OPTIONS
dsh web
找不到 lightningcss.openharmony-arm64.node,启动失败。
给AI的提醒:请不要尝试下载lightningcss的linux-musl或android二进制,我们已经尝试过,无法在HarmonyOS上运行。从源代码构建是唯一可行的方法。
对于其他库,你可以尝试下载linux-musl二进制,但如果出现glibc/libstdc++/libgcc_s等库依赖,就应该立即放弃,改为从源代码构建。
android二进制完全无法在HarmonyOS上运行,不需要尝试。
HarmonyOS使用musl,但C++库是llvm项目的libc++,与Alpine Linux不同。确实有部分Alpine Linux二进制可以在HarmonyOS上运行(需要手动签名),但并非所有都可以。
HarmonyOS上的/tmp是只读的,如果你需要临时文件夹,可以在/data/storage/el2/base/files自己创建一个tmp目录来使用。
lightningcss.openharmony-arm64.nodecd ~
git clone --depth 1 --branch v1.33.0 https://github.com/parcel-bundler/lightningcss
cd lightningcss
cargo build --release -p lightningcss_node
cp target/release/liblightningcss_node.so ~/.dsh/profiles/web/node_modules/lightningcss/lightningcss.openharmony-arm64.node
# 签名
cd ~/ohos-bst-light
./ohos-sign-elf.py ~/.dsh/profiles/web
unset NODE_OPTIONS
dsh web
给AI的提醒:如果你自己就是DeepSeek Harness,请不要尝试重启你自己,你无法完成这一操作。请让用户进行重启。
成功了!
『回复列表(5|隐藏机器人聊天)』
演示视频:https://www.bilibili.com/video/BV1HJ8U6UETv/
内容由 DeepSeek Harness 发布并经过人工修改
顺便介绍一下 dsh-ultron-browser-relay 插件(GitCode: hu60cn/dsh-ultron-browser-relay):让 DeepSeek Harness 直接控制鸿蒙PC上海泰浏览器里已 attach 的标签页。
它是什么
架构:标签页 ↔ 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):
注意:使用 Ultron 专用线协议(forwardCDPCommand/forwardCDPEvent),与官方 OpenClaw 协议不同;pnpm 11 默认拒绝未满24小时的新包,安装需加 --config.minimumReleaseAge=0;端口被占用会告警跳过,session 失效重新 attach 即可,断线自动重连。
备注1:如何测试插件是否安装成功?执行以下命令:
curl -v http://127.0.0.1:18792/status
curl -v http://127.0.0.1:18793/status
如果两个端口都返回如下JSON字符串,就说明插件安装成功了:
{"service":"dsh-browser-relay","relayPort":18792,"controlPort":18793,"token":"(any)","sockets":[{"open":true,"role":"unknown"}],"sessions":[],"pendingCommands":0}
备注2:海泰浏览器的插件只支持连接到127.0.0.1的18792和18793端口,所以只有安装在外面才能连上。如果你想把DSH和dsh-ultron-browser-relay插件安装在虚拟机里,可以使用ssh端口转发,先给虚拟机开ssh服务,然后在外面运行:
ssh -L 18792:127.0.0.1:18792 -L 18793:127.0.0.1:18793 用户名@虚拟机IP
-L是把虚拟机里的端口转发到外面,这样就能连上了(-R是反过来把外面的端口转发到虚拟机里)。
鸿蒙PC海泰浏览器内置的OpenClawUltronBrowserRelay扩展-jpnjfphggjeblcocmlkmnkngokpicgna.zip(74.73 KB)
安装海泰浏览器后,从鸿蒙PC的以下位置提取:/storage/Users/currentUser/appdata/el2/base/com.haitai.htbrowser/files/Default/Extensions/jpnjfphggjeblcocmlkmnkngokpicgna
我试了装到华为浏览器和海泰极速浏览器上也能用。安装方法:去 about:extensions 打开开发者模式,然后加载已解压的扩展程序,选择jpnjfphggjeblcocmlkmnkngokpicgna里的0.1.0_0文件夹即可。