e9879a41bf8c623fea7a707de6f03e05003c658d
DSHWatch_Server
DSHWatch 中继服务器(Node.js)。它作为一个受控的 Broker:
- DSH 插件(dsh-watch,运行在 DeepSeek Harness 里)主动 外连 到本服务器并注册 userId。
- 手机客户端(原生 Android APP,DSHWatchPhone)连接本服务器,用同一个 userId/token 获得对该 Harness 的控制权。
- 手环/手表(DSHWatch)只能走蓝牙,所以由手机 APP 作为网关:手机把从服务器来的状态/事件通过 system.interconnect 发给手表,也把手表上的指令/输入转发回服务器。
服务器本身不保存任何会话内容,只做鉴权 + 转发 + 在线状态广播。
启动
cd DSHWatch_Server
cp config.example.json config.json # 然后修改 token
npm install
npm start
默认监听 0.0.0.0:8787,健康检查:GET /health。
WebSocket 协议
所有消息都是 JSON 文本帧。
握手(Hello)
DSH 插件(Harness 侧):
{ "type": "hello", "role": "dsh", "userId": "someone", "token": "..." }
客户端(手机 APP / 手表网关):
{ "type": "hello", "role": "client", "userId": "someone", "token": "..." }
服务器回:
{ "type": "hello", "role": "client", "online": true, "harness": true, "status": { ... } }
客户端 -> 服务器 -> Harness
客户端发送请求:
{ "type": "request", "requestId": "abc", "method": "session.prompt", "params": { ... } }
服务器转发给 Harness(requestId 保持不变),Harness 回:
{ "type": "response", "requestId": "abc", "ok": true, "result": { ... } }
服务器按客户端原始 requestId 回给客户端。
Harness -> 服务器 -> 客户端
Harness 推送状态快照 / 会话事件:
{ "type": "status", "status": { ... } }
{ "type": "event", "event": { "type": "session/event", "sessionId": "...", "event": { ... } } }
服务器广播给该 userId 下的所有客户端。
心跳
任意一端都可发 { "type": "ping" },服务器回 { "type": "pong" }。
部署
公网部署(腾讯云等)时:
- 把 host 设为 0.0.0.0;
- 用防火墙/安全组放行 8787;
- 强烈建议在 Nginx/Caddy 后面挂 TLS(wss://),token 不要走明文;
- 不要把 token 写进 git;用环境变量 DSHWATCH_TOKEN 或本地 config.json(加进 .gitignore)。
Languages
JavaScript
95.6%
Shell
2.4%
Batchfile
2%