Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dsh-web-proxy

按需启动 DeepSeek Harness Web UI 的 macOS launchd 代理。

平时不跑 npx @deepseek-ai/dsh web,只是有一个很小的 Python 代理常驻在 127.0.0.1:3080。当浏览器访问这个地址时,代理自动执行:

cd ~/Documents/DSH
npx --yes @deepseek-ai/dsh web --no-open --host 127.0.0.1 --port 0

并把流量转发给启动出来的 dsh web。关闭网页后,代理检测到没有活动连接, 空闲一段时间(默认 10 秒)后自动结束 dsh 进程组,相当于「退出」。

安装

git clone https://github.com/<your-account>/dsh-web-proxy.git
cd dsh-web-proxy
./install.sh

然后打开 http://127.0.0.1:3080/ 即可。

install.sh 会把脚本复制到 ~/Library/Application Support/dsh-web-proxy/, 并生成一个 LaunchAgent 到 ~/Library/LaunchAgents/com.dsh.web-proxy.plist, 通过 launchd 实现登录自动常驻。

环境变量

可以在运行 install.sh 前设置:

变量 默认值 说明
DSH_PROXY_LABEL com.dsh.web-proxy launchd service label
DSH_PROXY_LISTEN_PORT 3080 代理监听端口
DSH_PROXY_IDLE_TIMEOUT 10 关闭页面后空闲多少秒杀掉 dsh
DSH_PROXY_DIR ~/Documents/DSH 启动 dsh 时的工作目录(dsh web 本身也可以用 --port 0)

注意:DSH_PROXY_DIR 是在 dsh-web-proxy.py 内读取的环境变量;如果 launchd 运行时要自定义它,请在生成的 plist 的 EnvironmentVariables 里增加。

卸载

./uninstall.sh

或者手动:

launchctl bootout gui/$(id -u)/com.dsh.web-proxy
rm ~/Library/LaunchAgents/com.dsh.web-proxy.plist
rm -rf ~/Library/Application\ Support/dsh-web-proxy

日志

文件 内容
/tmp/dsh-web-proxy.log 代理日志(启动、按需拉起、空闲退出)
/tmp/dsh-web-server-*.log dsh web 进程输出
/tmp/dsh-web-proxy-launchd.log launchd 的 stdout/stderr

常见问题

launchd 日志里出现 Operation not permitted

不要把 dsh-web-proxy.py 放在 ~/Documents、~/Desktop、~/Downloads 下 让 launchd 直接运行。macOS 的 TCC 隐私保护会拒绝 launchd 进程读取这些目录。 install.sh 默认复制到 ~/Library/Application Support/dsh-web-proxy/, 这个位置不受影响。

端口 3080 被占用

说明你已经手动跑了 npx @deepseek-ai/dsh web。关掉它即可;启用本代理后 不需要再手动运行原命令。

License

MIT

About

On-demand launchd proxy for the DeepSeek Harness (dsh) Web UI on macOS

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages