dsh-client-auto-continue 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +231 -0
- package/README.zh.md +228 -0
- package/cordis.patch.yml +7 -0
- package/lib/client.js +1197 -0
- package/lib/index.js +38 -0
- package/lib/types/client/engine.d.ts +78 -0
- package/lib/types/client/index.d.ts +30 -0
- package/lib/types/client/locales.d.ts +48 -0
- package/lib/types/client/settings-card.d.ts +47 -0
- package/lib/types/client/settings-form.d.ts +123 -0
- package/lib/types/client/styles.d.ts +8 -0
- package/lib/types/index.d.ts +59 -0
- package/package.json +82 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 HsiangNianian
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/banner-dark.svg">
|
|
4
|
+
<img src="docs/banner.svg" alt="dsh-auto-continue" width="720">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<h1 align="center">dsh-auto-continue</h1>
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
<em>DSH Web UI plugin — when a request is interrupted by a network error or any other non-human cause, it automatically types 「继续」 and sends it for you.</em>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://www.npmjs.com/package/dsh-client-auto-continue"><img src="https://img.shields.io/npm/v/dsh-client-auto-continue?logo=npm&label=npm" alt="npm version"></a>
|
|
16
|
+
<a href="https://www.npmjs.com/package/dsh-client-auto-continue"><img src="https://img.shields.io/npm/dm/dsh-client-auto-continue?label=downloads" alt="npm downloads"></a>
|
|
17
|
+
<a href="https://github.com/HsiangNianian/dsh-auto-continue/stargazers"><img src="https://img.shields.io/github/stars/HsiangNianian/dsh-auto-continue?logo=github&label=Stars" alt="GitHub stars"></a>
|
|
18
|
+
<a href="https://github.com/HsiangNianian/dsh-auto-continue/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-65a30d?style=flat" alt="MIT license"></a>
|
|
19
|
+
<br>
|
|
20
|
+
<img src="https://img.shields.io/badge/TypeScript-3178C6?style=flat&logo=typescript&logoColor=fff" alt="TypeScript">
|
|
21
|
+
<img src="https://img.shields.io/badge/esbuild-FFCF00?style=flat&logo=esbuild&logoColor=000" alt="esbuild">
|
|
22
|
+
<img src="https://img.shields.io/badge/GUI--configurable-0ea5e9?style=flat" alt="GUI configurable">
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
<p align="center">
|
|
26
|
+
<b>English</b> · <a href="README.zh.md">中文</a>
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## What It Does
|
|
32
|
+
|
|
33
|
+
For [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (`dsh web`): whenever a request in the web GUI gets interrupted by a **non-human cause**, the plugin simulates the user typing **「继续」** and sends it, so the agent keeps working without manual intervention. The message enters the session log exactly like a manual prompt — the model sees it, and the interrupted work resumes.
|
|
34
|
+
|
|
35
|
+
It watches the live event streams and reacts to:
|
|
36
|
+
|
|
37
|
+
| Event | Meaning |
|
|
38
|
+
| --- | --- |
|
|
39
|
+
| `turn/end` → `error` | Turn failed (model / network / timeout, …) |
|
|
40
|
+
| `turn/end` → `interrupted` | Crash-orphaned turn left behind by a host restart |
|
|
41
|
+
| `turn/end` → `max-tokens` | Output token ceiling reached |
|
|
42
|
+
| `host/agent-error` | Agent failure with no turn position |
|
|
43
|
+
|
|
44
|
+
**Never auto-continues:** user-aborted turns (`aborted`) or policy rejections (`blocked`); sessions the host already resumed itself; running sessions or sessions with queued messages; subagent sessions; anything inside the cooldown / consecutive-cap windows (configurable in the settings card, below).
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## How It Works
|
|
49
|
+
|
|
50
|
+
The plugin opens two extra SSE streams in the browser — `events.mux` (session events) and `events.host` (host events). The host supports multiple consumers, so this never interferes with the built-in runtime. On an interruption it waits a **grace period** (default 3 s) — if the host starts a new turn by itself (`turn/start`), the auto-continue is cancelled — then calls `sessions.prompt` in `queue` mode with the configured text.
|
|
51
|
+
|
|
52
|
+
On page load / reconnect it also scans the most recently updated sessions: a session whose last turn ended with a non-human reason **within the scan window** (default 15 minutes), with no later `turn/start` or user message, gets resumed automatically too (e.g. the host crashed while the browser was closed).
|
|
53
|
+
|
|
54
|
+
All knobs live in the plugin's settings card — see [Configuration](#configuration).
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Quick Start
|
|
59
|
+
|
|
60
|
+
DSH plugins install into a **profile** (`dsh web` → `web` profile). Install, restart `dsh web`, done.
|
|
61
|
+
|
|
62
|
+
### From npm (recommended)
|
|
63
|
+
|
|
64
|
+
Published as [`dsh-client-auto-continue`](https://www.npmjs.com/package/dsh-client-auto-continue):
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
dsh plugin --profile web add dsh-client-auto-continue
|
|
68
|
+
dsh web
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### From this repository
|
|
72
|
+
|
|
73
|
+
Requires Node.js ≥ 18.
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
git clone https://github.com/HsiangNianian/dsh-auto-continue.git
|
|
77
|
+
cd dsh-auto-continue
|
|
78
|
+
npm install
|
|
79
|
+
npm run build
|
|
80
|
+
|
|
81
|
+
# the package carries its own cordis.patch.yml (dsh.bundle.patch),
|
|
82
|
+
# so the plugin row registers itself
|
|
83
|
+
dsh plugin --profile web add link:$(pwd)
|
|
84
|
+
|
|
85
|
+
dsh web
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Manual (no pnpm / dsh plugin needed)
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
ln -sfn "$(pwd)" ~/.dsh/profiles/node_modules/dsh-client-auto-continue
|
|
92
|
+
# then append to ~/.dsh/profiles/web/cordis.patch.yml:
|
|
93
|
+
# - insert:
|
|
94
|
+
# - id: auto-continue
|
|
95
|
+
# name: 'dsh-client-auto-continue'
|
|
96
|
+
dsh web
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
> Switching from a manual install to `dsh plugin add`? Remove the manual `insert` entry first — the bundle patch registers the row and a duplicate would conflict.
|
|
100
|
+
|
|
101
|
+
> **Known DSH limitation (0.1.0-rc.6):** the web plugin-configuration section only
|
|
102
|
+
> exposes settings namespaces on a hardcoded allowlist in the installed
|
|
103
|
+
> `@deepseek-ai/dsh-host-apiproxy` bundle. To make the settings card appear, run
|
|
104
|
+
> the idempotent vendor patch once (re-run it after reinstalling dsh):
|
|
105
|
+
>
|
|
106
|
+
> ```sh
|
|
107
|
+
> node scripts/patch-expose.mjs
|
|
108
|
+
> dsh web
|
|
109
|
+
> ```
|
|
110
|
+
>
|
|
111
|
+
> The auto-continue engine itself works without this patch — it only gates the
|
|
112
|
+
> GUI settings card.
|
|
113
|
+
|
|
114
|
+
### Verify & uninstall
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
dsh --profile web --dump-config | grep auto-continue # config layer mounted
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
In the browser console (Ctrl/Cmd+Shift+I): `[auto-continue] 已启动(文本="继续", …)` — every detection and auto-send is logged.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
dsh plugin --profile web remove dsh-client-auto-continue # npm / repo install
|
|
124
|
+
# or remove the symlink + the insert entry # manual install
|
|
125
|
+
dsh web
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Configuration
|
|
131
|
+
|
|
132
|
+
Everything is configurable from the GUI — no file or console edits needed. Open **Settings → Plugin configuration** and find the **Auto continue** card. Changes are staged and written on **Save**, apply immediately, and persist in `~/.dsh/settings.yaml`.
|
|
133
|
+
|
|
134
|
+
| Field | Default | Description |
|
|
135
|
+
| --- | --- | --- |
|
|
136
|
+
| Continue text | `继续` | Text automatically sent after an interruption |
|
|
137
|
+
| Grace period (ms) | `3000` | Wait after an interruption; cancelled if the host recovers on its own |
|
|
138
|
+
| Cooldown (ms) | `20000` | Min interval between auto-continues per session (failed attempts count too) |
|
|
139
|
+
| Max consecutive | `3` | Max consecutive auto-continues; stops until a user intervenes or a turn completes |
|
|
140
|
+
| Scan on load / reconnect | `on` | Scan recently interrupted sessions on load / reconnect |
|
|
141
|
+
| Scan limit | `8` | Max sessions scanned (running / subagent sessions excluded) |
|
|
142
|
+
| Scan window (ms) | `900000` | Scan only considers interruptions inside this window |
|
|
143
|
+
| Reconnect scan delay (ms) | `5000` | Delay before scanning after a reconnect |
|
|
144
|
+
| Reconnect backoff (ms) | `3000` | SSE reconnect backoff |
|
|
145
|
+
| Verbose logs | `on` | `[auto-continue]` console logs |
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Tech Stack & Structure
|
|
150
|
+
|
|
151
|
+
| Layer | Choice |
|
|
152
|
+
| --- | --- |
|
|
153
|
+
| Platform | DSH Web GUI client plugin (browser half + host half registering the settings namespace) |
|
|
154
|
+
| Language | TypeScript |
|
|
155
|
+
| Build | esbuild (browser bundle + node half) + tsc declarations |
|
|
156
|
+
| Runtime deps | Browser bundle: `react` (platform seed) + `createSnapshotStore` (module table); host half: `schemastery` + `dsh-settings` (resolved from the dsh installation) |
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
dsh-auto-continue/
|
|
160
|
+
├── package.json # plugin manifest (dsh.client / dsh.bundle)
|
|
161
|
+
├── cordis.patch.yml # profile patch layer: registers the plugin row
|
|
162
|
+
├── build.mjs # esbuild build (browser bundle + node half)
|
|
163
|
+
├── tsconfig.json / tsconfig.build.json
|
|
164
|
+
├── src/
|
|
165
|
+
│ ├── index.ts # host half: registers the auto-continue settings namespace
|
|
166
|
+
│ └── client/
|
|
167
|
+
│ ├── index.ts # browser half entry: engine + settings card wiring
|
|
168
|
+
│ ├── engine.ts # the auto-continue engine (reads the settings scope)
|
|
169
|
+
│ ├── settings-card.tsx / settings-form.ts / locales.ts / styles.ts
|
|
170
|
+
│ └── # settings card UI (staged form, zh/en copy, theme styles)
|
|
171
|
+
├── tests/simulate.mjs # headless behavioral tests (mock API + settings scope)
|
|
172
|
+
├── lib/ # build output (committed, ready to link)
|
|
173
|
+
├── docs/ # banner artwork (en + zh)
|
|
174
|
+
└── README.md / README.zh.md / LICENSE
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Development
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
npm run typecheck # tsc --noEmit
|
|
183
|
+
npm run build # lib/client.js + lib/index.js + lib/types
|
|
184
|
+
npm run watch # rebuild on change; host HMR hot-reloads without a page refresh
|
|
185
|
+
npm run test # node tests/simulate.mjs — 8 behavioral scenarios
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
While `npm run watch` runs, the profile's client-hmr row polls `lib/client.js` every 500 ms and hot-reloads the plugin in the browser — no server restart needed for code changes.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
## Publishing
|
|
194
|
+
|
|
195
|
+
Tagging `v<version>` (matching `package.json`) triggers the publish workflow:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
git tag v0.2.0
|
|
199
|
+
git push origin v0.2.0
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
The CI (`.github/workflows/publish.yml`) then:
|
|
203
|
+
|
|
204
|
+
1. Verifies the tag matches `package.json` version
|
|
205
|
+
2. Installs dependencies, builds (`npm run build`) and runs the test suite
|
|
206
|
+
3. Publishes the package to npm (`dsh-client-auto-continue`)
|
|
207
|
+
4. Creates a GitHub Release with the packed tarball and built artifacts
|
|
208
|
+
(`lib/client.js`, `lib/client.js.map`, `lib/index.js`) attached
|
|
209
|
+
|
|
210
|
+
The workflow requires the `NPM_TOKEN` repository secret (an npm automation
|
|
211
|
+
token with publish scope):
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
gh secret set NPM_TOKEN --repo HsiangNianian/dsh-auto-continue
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Links
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
- **Repository**: [github.com/HsiangNianian/dsh-auto-continue](https://github.com/HsiangNianian/dsh-auto-continue)
|
|
223
|
+
- **DeepSeek Harness**: [github.com/deepseek-ai/deepseek-harness](https://github.com/deepseek-ai/deepseek-harness)
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## License
|
|
228
|
+
|
|
229
|
+
[](LICENSE)
|
|
230
|
+
|
|
231
|
+
MIT © Hsiang Nianian
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="docs/banner-zh-dark.svg">
|
|
4
|
+
<img src="docs/banner-zh.svg" alt="dsh-auto-continue" width="720">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<h1 align="center">dsh-auto-continue</h1>
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
<em>DSH Web UI 插件 —— 当请求因为网络错误等非人为因素中断时, 自动替你输入「继续」并发送。</em>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://www.npmjs.com/package/dsh-client-auto-continue"><img src="https://img.shields.io/npm/v/dsh-client-auto-continue?logo=npm&label=npm" alt="npm version"></a>
|
|
16
|
+
<a href="https://www.npmjs.com/package/dsh-client-auto-continue"><img src="https://img.shields.io/npm/dm/dsh-client-auto-continue?label=downloads" alt="npm downloads"></a>
|
|
17
|
+
<a href="https://github.com/HsiangNianian/dsh-auto-continue/stargazers"><img src="https://img.shields.io/github/stars/HsiangNianian/dsh-auto-continue?logo=github&label=Stars" alt="GitHub stars"></a>
|
|
18
|
+
<a href="https://github.com/HsiangNianian/dsh-auto-continue/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-65a30d?style=flat" alt="MIT license"></a>
|
|
19
|
+
<br>
|
|
20
|
+
<img src="https://img.shields.io/badge/TypeScript-3178C6?style=flat&logo=typescript&logoColor=fff" alt="TypeScript">
|
|
21
|
+
<img src="https://img.shields.io/badge/esbuild-FFCF00?style=flat&logo=esbuild&logoColor=000" alt="esbuild">
|
|
22
|
+
<img src="https://img.shields.io/badge/zero__runtime__deps-16a34a?style=flat" alt="GUI 可配置">
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
<p align="center">
|
|
26
|
+
<a href="README.md">English</a> · <b>中文</b>
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 它做什么
|
|
32
|
+
|
|
33
|
+
适用于 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(`dsh web`): 当 webui 里的请求因为**非人为因素**中断时, 插件模拟用户输入 **「继续」** 并自动发送, 让 Agent 继续干活, 无需手动干预。消息与手动输入完全等价——进入会话日志、对模型可见, 中断的任务随即恢复。
|
|
34
|
+
|
|
35
|
+
插件监听实时事件流, 对以下情况作出反应:
|
|
36
|
+
|
|
37
|
+
| 事件 | 含义 |
|
|
38
|
+
| --- | --- |
|
|
39
|
+
| `turn/end` → `error` | 回合失败(模型 / 网络 / 超时等) |
|
|
40
|
+
| `turn/end` → `interrupted` | 宿主崩溃重启后遗留的中断回合 |
|
|
41
|
+
| `turn/end` → `max-tokens` | 达到输出 token 上限 |
|
|
42
|
+
| `host/agent-error` | 无回合位置的 Agent 失败 |
|
|
43
|
+
|
|
44
|
+
**绝不自动继续:** 用户主动停止(`aborted`)或策略拒绝(`blocked`); 宿主已自行恢复的会话; 正在运行或已有排队消息的会话; 子代理会话; 处于冷却期 / 连续次数上限内的会话(可在设置卡片中调整, 见下)。
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 工作原理
|
|
49
|
+
|
|
50
|
+
插件在浏览器里额外打开两条 SSE 流——`events.mux`(会话事件)与 `events.host`(宿主事件)。宿主支持多消费者, 与内置运行时互不干扰。检测到中断后先等待一个**宽限期**(默认 3 秒)——若宿主自行开启了新回合(`turn/start`), 自动继续即取消——然后以 `queue` 模式调用 `sessions.prompt` 发送配置的文本。
|
|
51
|
+
|
|
52
|
+
页面启动 / 重连时, 插件还会扫描最近更新的会话: 若某个会话的最后一个回合在**扫描时间窗**(默认 15 分钟)内以非人为原因结束, 且之后没有新的 `turn/start` 或用户消息, 也会被自动续跑(例如浏览器关闭期间宿主崩溃的情况)。
|
|
53
|
+
|
|
54
|
+
所有参数都在插件的设置卡片中调整——见 [配置](#配置)。
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 快速开始
|
|
59
|
+
|
|
60
|
+
DSH 插件安装进 **profile**(`dsh web` 对应 `web` profile)。安装后重启 `dsh web` 即可。
|
|
61
|
+
|
|
62
|
+
### 从 npm 安装(推荐)
|
|
63
|
+
|
|
64
|
+
已发布为 [`dsh-client-auto-continue`](https://www.npmjs.com/package/dsh-client-auto-continue):
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
dsh plugin --profile web add dsh-client-auto-continue
|
|
68
|
+
dsh web
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 从本仓库安装
|
|
72
|
+
|
|
73
|
+
需要 Node.js ≥ 18。
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
git clone https://github.com/HsiangNianian/dsh-auto-continue.git
|
|
77
|
+
cd dsh-auto-continue
|
|
78
|
+
npm install
|
|
79
|
+
npm run build
|
|
80
|
+
|
|
81
|
+
# 包自带 cordis.patch.yml(通过 dsh.bundle.patch 声明),
|
|
82
|
+
# 插件行会自动注册
|
|
83
|
+
dsh plugin --profile web add link:$(pwd)
|
|
84
|
+
|
|
85
|
+
dsh web
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 手动安装(无需 pnpm / dsh plugin)
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
ln -sfn "$(pwd)" ~/.dsh/profiles/node_modules/dsh-client-auto-continue
|
|
92
|
+
# 然后在 ~/.dsh/profiles/web/cordis.patch.yml 追加:
|
|
93
|
+
# - insert:
|
|
94
|
+
# - id: auto-continue
|
|
95
|
+
# name: 'dsh-client-auto-continue'
|
|
96
|
+
dsh web
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
> 从手动安装切换到 `dsh plugin add` 时, 请先删掉手动加的 `insert` 条目——包自带的 bundle patch 会注册插件行, 重复注册会冲突。
|
|
100
|
+
|
|
101
|
+
> **已知 DSH 限制(0.1.0-rc.6):** webui 的插件配置区只暴露已安装
|
|
102
|
+
> `@deepseek-ai/dsh-host-apiproxy` 包中硬编码白名单里的设置命名空间。要让设置卡片
|
|
103
|
+
> 显示出来, 需要执行一次幂等的供应商补丁(重新安装 dsh 后重跑一次即可):
|
|
104
|
+
>
|
|
105
|
+
> ```sh
|
|
106
|
+
> node scripts/patch-expose.mjs
|
|
107
|
+
> dsh web
|
|
108
|
+
> ```
|
|
109
|
+
>
|
|
110
|
+
> 自动续跑引擎本身不依赖这个补丁——它只影响 GUI 设置卡片是否可见。
|
|
111
|
+
|
|
112
|
+
### 验证与卸载
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
dsh --profile web --dump-config | grep auto-continue # 确认配置层已挂载
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
浏览器控制台(Ctrl/Cmd+Shift+I)中应看到 `[auto-continue] 已启动(文本="继续", …)`; 每次检测到中断和自动发送都会打日志。
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
dsh plugin --profile web remove dsh-client-auto-continue # npm / 仓库安装
|
|
122
|
+
# 或删除软链 + insert 条目 # 手动安装
|
|
123
|
+
dsh web
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## 配置
|
|
129
|
+
|
|
130
|
+
所有参数都可以在 GUI 里配置——无需改文件或控制台。打开 **设置 → 插件配置**, 找到 **自动继续** 卡片。修改后点 **保存** 生效, 立即应用, 并持久化到 `~/.dsh/settings.yaml`。
|
|
131
|
+
|
|
132
|
+
| 字段 | 默认 | 说明 |
|
|
133
|
+
| --- | --- | --- |
|
|
134
|
+
| 继续文本 | `继续` | 中断后自动发送的消息内容 |
|
|
135
|
+
| 宽限期 (ms) | `3000` | 中断后等待的时长; 期间宿主自行恢复则取消 |
|
|
136
|
+
| 冷却时间 (ms) | `20000` | 同一会话两次自动「继续」的最小间隔(失败尝试也计入) |
|
|
137
|
+
| 最大连续次数 | `3` | 同一会话连续自动「继续」上限; 超过后停止, 直到用户介入或成功回合 |
|
|
138
|
+
| 启动/重连扫描 | 开 | 页面启动 / 重连时扫描最近中断的会话 |
|
|
139
|
+
| 扫描会话数 | `8` | 扫描最多检查的会话数(不含运行中 / 子代理会话) |
|
|
140
|
+
| 扫描时间窗 (ms) | `900000` | 扫描只处理该时间窗内的中断 |
|
|
141
|
+
| 重连扫描延迟 (ms) | `5000` | 重连后等待宿主恢复再扫描 |
|
|
142
|
+
| 重连退避 (ms) | `3000` | SSE 流断开后的重连间隔 |
|
|
143
|
+
| 详细日志 | 开 | 控制台输出 `[auto-continue]` 日志 |
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## 技术栈与结构
|
|
148
|
+
|
|
149
|
+
| 分层 | 选型 |
|
|
150
|
+
| --- | --- |
|
|
151
|
+
| 平台 | DSH Web GUI 客户端插件(浏览器半区 + 注册设置命名空间的宿主半区) |
|
|
152
|
+
| 语言 | TypeScript |
|
|
153
|
+
| 构建 | esbuild(浏览器包 + 宿主半区)+ tsc 声明文件 |
|
|
154
|
+
| 运行时依赖 | 浏览器包: `react`(平台种子)+ `createSnapshotStore`(模块表); 宿主半区: `schemastery` + `dsh-settings`(由 dsh 安装解析) |
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
dsh-auto-continue/
|
|
158
|
+
├── package.json # 插件清单(dsh.client / dsh.bundle)
|
|
159
|
+
├── cordis.patch.yml # profile 补丁层: 注册插件行
|
|
160
|
+
├── build.mjs # esbuild 构建(浏览器包 + 宿主半区)
|
|
161
|
+
├── tsconfig.json / tsconfig.build.json
|
|
162
|
+
├── src/
|
|
163
|
+
│ ├── index.ts # host 半区: 注册 auto-continue 设置命名空间
|
|
164
|
+
│ └── client/
|
|
165
|
+
│ ├── index.ts # browser 半区入口: 引擎 + 设置卡片接线
|
|
166
|
+
│ ├── engine.ts # 自动续跑引擎(读取设置作用域)
|
|
167
|
+
│ ├── settings-card.tsx / settings-form.ts / locales.ts / styles.ts
|
|
168
|
+
│ └── # 设置卡片 UI(暂存表单、中英文案、主题样式)
|
|
169
|
+
├── tests/simulate.mjs # 无头行为测试(模拟 API + 设置作用域)
|
|
170
|
+
├── lib/ # 构建产物(已提交, 可直接链接)
|
|
171
|
+
├── docs/ # banner 图(英文 + 中文)
|
|
172
|
+
└── README.md / README.zh.md / LICENSE
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## 开发
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
npm run typecheck # tsc --noEmit
|
|
181
|
+
npm run build # lib/client.js + lib/index.js + lib/types
|
|
182
|
+
npm run watch # 监听变更自动重建; 宿主 HMR 免刷新热重载
|
|
183
|
+
npm run test # node tests/simulate.mjs — 8 个行为场景
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
`npm run watch` 运行时, profile 的 client-hmr 行每 500ms 轮询 `lib/client.js` 并在浏览器中热重载插件——改代码无需重启服务。
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
## 发布
|
|
192
|
+
|
|
193
|
+
打一个与 `package.json` 版本一致的 `v<version>` tag, 即可触发发布流水线:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
git tag v0.2.0
|
|
197
|
+
git push origin v0.2.0
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
CI(`.github/workflows/publish.yml`)会依次:
|
|
201
|
+
|
|
202
|
+
1. 校验 tag 与 `package.json` 版本一致
|
|
203
|
+
2. 安装依赖、构建(`npm run build`)并跑测试套件
|
|
204
|
+
3. 发布到 npm(`dsh-client-auto-continue`)
|
|
205
|
+
4. 创建 GitHub Release, 附带打包好的 tarball 与构建产物
|
|
206
|
+
(`lib/client.js`、`lib/client.js.map`、`lib/index.js`)
|
|
207
|
+
|
|
208
|
+
流水线依赖仓库的 `NPM_TOKEN` secret(带 publish 权限的 npm automation token):
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
gh secret set NPM_TOKEN --repo HsiangNianian/dsh-auto-continue
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## 链接
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
- **仓库**: [github.com/HsiangNianian/dsh-auto-continue](https://github.com/HsiangNianian/dsh-auto-continue)
|
|
220
|
+
- **DeepSeek Harness**: [github.com/deepseek-ai/deepseek-harness](https://github.com/deepseek-ai/deepseek-harness)
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## License
|
|
225
|
+
|
|
226
|
+
[](LICENSE)
|
|
227
|
+
|
|
228
|
+
MIT © Hsiang Nianian
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Bundle patch for the auto-continue plugin: inserts its plugin row into the
|
|
2
|
+
# web profile roster. Applied as a profile bundle layer (the `dsh.bundle.patch`
|
|
3
|
+
# manifest field); install with `dsh plugin --profile web add <package>` or
|
|
4
|
+
# `dsh plugin --profile web add link:<repo path>`.
|
|
5
|
+
- insert:
|
|
6
|
+
- id: auto-continue
|
|
7
|
+
name: 'dsh-client-auto-continue'
|