112 lines
3.2 KiB
Markdown
112 lines
3.2 KiB
Markdown
# dsh-watch
|
||
|
||
DeepSeek Harness 插件:把当前 Harness 变成一个可被 **DSHWatch 手机 / 手表** 远程控制的端点。
|
||
插件负责把 Harness 的会话/状态/事件**串**给 DSHWatch 客户端;客户端用 WebView 串 Harness 网页壳,数据由本插件填入。
|
||
|
||
---
|
||
|
||
## ✅ 一条命令安装(给 AI / 他人)
|
||
|
||
> 你只需把本仓库链接给 AI(或用户),让它执行下面任意一种即可装好。
|
||
|
||
### 方式 A:克隆仓库后装打包好的插件(推荐)
|
||
|
||
```bash
|
||
git clone https://gitea.truestudio.cn/jiangchen/dsh-watch.git
|
||
cd dsh-watch
|
||
# 插件已打包在 dist/。用 DSH 的 dsh CLI 把它装到桌面 profile:
|
||
dsh plugin --profile desktop add "$(pwd)/dist/dsh-watch-0.1.0.tgz"
|
||
```
|
||
|
||
### 方式 B:本地 link 开发模式
|
||
|
||
```bash
|
||
git clone https://gitea.truestudio.cn/jiangchen/dsh-watch.git
|
||
dsh plugin --profile desktop add link:$(pwd)/dsh-watch
|
||
```
|
||
|
||
### 方式 C:直接在仓库里跑安装脚本
|
||
|
||
```bash
|
||
git clone https://gitea.truestudio.cn/jiangchen/dsh-watch.git
|
||
cd dsh-watch
|
||
./scripts/install.sh # macOS / Linux
|
||
scripts\install.bat # Windows
|
||
```
|
||
|
||
### 对 AI 的明确指令(可直接粘贴给它)
|
||
|
||
```text
|
||
克隆仓库 https://gitea.truestudio.cn/jiangchen/dsh-watch.git,
|
||
在仓库目录运行 npm install 或 npm pack 确保 dist/dsh-watch-0.1.0.tgz 是最新,
|
||
然后用 DSH 的 CLI:dsh plugin --profile desktop add <repo绝对路径>/dist/dsh-watch-0.1.0.tgz
|
||
安装完成后在 DSH 设置 -> 插件 中配置 dsh-watch(mode / serverUrl / userId / token / apiKey / host / port)。
|
||
```
|
||
|
||
---
|
||
|
||
## 配置
|
||
|
||
装好后,在 DSH 的 profile cordis.patch.yml 或 设置 -> 插件 里加:
|
||
|
||
```yaml
|
||
- id: dsh-watch
|
||
config:
|
||
mode: direct # direct | relay
|
||
host: "0.0.0.0" # direct 模式监听地址
|
||
port: 18321 # direct 模式端口
|
||
token: "你自己定的token"
|
||
apiKey: "" # 可选:DeepSeek API Key(harness.balance 直查余额)
|
||
reconnectMs: 5000
|
||
timeoutMs: 30000
|
||
```
|
||
|
||
### 1. 直连模式(direct)
|
||
插件在本机起一个 WebSocket 服务,手机/手表直接填主机/端口/token 连进来(可配合 FRP / 内网穿透)。
|
||
|
||
手机端填:`ws://主机IP:18321` + 同一个 token。
|
||
|
||
### 2. 服务器中转模式(relay)
|
||
插件主动外连 DSHWatch_Server,手机端连同一台服务器,用同样的 userId/token。适合公网、无需给电脑开端口。
|
||
|
||
```yaml
|
||
- id: dsh-watch
|
||
config:
|
||
mode: relay
|
||
serverUrl: "wss://your-server:8787"
|
||
userId: "someone"
|
||
token: "shared-secret"
|
||
```
|
||
|
||
---
|
||
|
||
## 暴露方法(手机/手表端可调用)
|
||
|
||
透传 DSH apiProxy:
|
||
|
||
- harness.status / harness.prompt / harness.cancel / harness.balance
|
||
- session.list / session.history / session.create / session.prompt / session.cancel
|
||
- goal.* subagent.* workspace.* host.*
|
||
- skill.list agentPreset.* llm.* settings.* credentials.*
|
||
|
||
事件推送:session/event、session/projection、status。
|
||
|
||
---
|
||
|
||
## 开发
|
||
|
||
```bash
|
||
npm install
|
||
npm pack # 生成 dist/dsh-watch-0.1.0.tgz
|
||
node --check lib/index.js
|
||
```
|
||
|
||
## 依赖
|
||
- node >= 18
|
||
- ws(装在 DSH 宿主里即可)
|
||
|
||
## 关联仓库
|
||
- 服务端:DSHWatch_Server
|
||
- 手表端:DSHWatch
|
||
- 手机端:DSHWatchPhone
|