docs/install: AI-friendly one-command install (README + scripts/install.sh/.bat + fresh dist tgz)

This commit is contained in:
2026-09-02 01:15:10 +08:00
parent 711244c7ad
commit f4e14d8513
4 changed files with 95 additions and 48 deletions
+77 -48
View File
@@ -1,82 +1,111 @@
# dsh-watch
DeepSeek Harness 插件:把当前 Harness 变成一个可被 DSHWatch 手机/手表远程控制的端点。
DeepSeek Harness 插件:把当前 Harness 变成一个可被 **DSHWatch 手机 / 手表** 远程控制的端点。
插件负责把 Harness 的会话/状态/事件**串**给 DSHWatch 客户端;客户端用 WebView 串 Harness 网页壳,数据由本插件填入。
## 安装
---
像安装其他 DSH 插件一样,对 Harness 说"安装这个插件":
## ✅ 一条命令安装(给 AI / 他人)
dsh plugin --profile desktop add dsh-watch
> 你只需把本仓库链接给 AI(或用户),让它执行下面任意一种即可装好。
或本地开发安装:
### 方式 A:克隆仓库后装打包好的插件(推荐)
dsh plugin --profile desktop add link:D:/project/DeepSeek_Harness_Watch/dsh-watch
```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"
```
然后在 profile 的 cordis.patch.yml 配置:
### 方式 B:本地 link 开发模式
- id: dsh-watch
config:
mode: relay # relay | direct
serverUrl: "ws://你的服务器:8787"
userId: "dalong"
token: "与服务器/客户端一致的 token"
reconnectMs: 5000
timeoutMs: 30000
```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 / 内网穿透)。
插件在本机起一个 WebSocket 服务,手机端直接填主机/端口/token 连进来(可配合内网穿透/NAT 转发)。
- id: dsh-watch
config:
mode: direct
host: "0.0.0.0"
port: 18321
token: "你自己定的 token"
手机端填:ws://主机IP:18321 和同一个 token。
手机端填:`ws://主机IP:18321` + 同一个 token。
### 2. 服务器中转模式(relay)
插件主动外连 DSHWatch_Server,手机端连同一台服务器,用同样的 userId/token。适合公网、无需给电脑开端口。
插件主动外连 DSHWatch_Server(预设或手动填 serverUrl),手机端连同一个服务器,用同样的 userId/token。适合公网、不需要给电脑开端口。
```yaml
- id: dsh-watch
config:
mode: relay
serverUrl: "wss://your-server:8787"
userId: "someone"
token: "shared-secret"
```
- id: dsh-watch
config:
mode: relay
serverUrl: "wss://your-server:8787"
userId: "someone"
token: "shared-secret"
---
## DSH 设置页(手表/手机设置)
插件注册了 dsh-watch 设置命名空间。装好后,在 DSH 的 设置 -> 插件(或对应插件设置区)里可填:
- mode: direct / relay
- serverUrl / userId / token
- apiKey(DeepSeek API Key,用于 harness.balance 直接查余额;留空则用 DEEPSEEK_API_KEY 环境变量/credentials)
- reconnectMs / timeoutMs
- host / port(direct 模式)
## 暴露方法
## 暴露方法(手机/手表端可调用)
透传 DSH apiProxy:
- harness.status / harness.prompt / harness.cancel / harness.balance
- session.list create history prompt cancel rename fork models selectModel attachment
- 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
BIN
View File
Binary file not shown.
+11
View File
@@ -0,0 +1,11 @@
@echo off
cd /d %~dp0\..
set TGZ=%CD%\dist\dsh-watch-0.1.0.tgz
if not exist "%TGZ%" (
call npm install
call npm pack
copy /y dsh-watch-0.1.0.tgz dist\ >nul
del /q dsh-watch-0.1.0.tgz
)
dsh plugin --profile desktop add "%TGZ%"
echo dsh-watch installed/updated
+7
View File
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -e
cd "$(dirname "$0")/.."
TGZ="$(pwd)/dist/dsh-watch-0.1.0.tgz"
if [ ! -f "$TGZ" ]; then npm install; npm pack; cp dsh-watch-0.1.0.tgz dist/; rm -f dsh-watch-0.1.0.tgz; fi
dsh plugin --profile desktop add "$TGZ"
echo "✅ dsh-watch 已安装/更新"