dsh-mcviseron-plugin 0.7.3 → 0.8.1
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/CHANGELOG.md +85 -0
- package/README.en.md +17 -13
- package/README.md +22 -18
- package/docs/archive-integration.md +29 -0
- package/docs/auto-review-context.md +25 -24
- package/docs/automation-task.md +1 -1
- package/docs/automation-tasks.md +49 -0
- package/docs/linux-restart.md +96 -0
- package/lib/auto-review-fix.js +135 -6
- package/lib/client.js +172 -27
- package/lib/index.js +421 -84
- package/lib/restart.js +94 -16
- package/package.json +24 -23
- package/src/api.ts +5 -0
- package/src/archive-integration/index.ts +83 -0
- package/src/auto-review-fix/index.ts +2 -2
- package/src/automation-tasks/index.ts +55 -14
- package/src/client/RestartCard.tsx +38 -5
- package/src/client/SettingsSection.tsx +92 -3
- package/src/client/locales.ts +50 -12
- package/src/components/auto-review-fix/index.ts +2 -2
- package/src/components/auto-review-fix/review-context.ts +144 -2
- package/src/index.ts +2 -0
- package/src/restart/index.ts +139 -30
- package/src/session-end/index.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
## [0.8.1] - 2026-11-22
|
|
2
|
+
|
|
3
|
+
### Fixed
|
|
4
|
+
|
|
5
|
+
- **Linux CI 测试环境差异**:`resolveRestartTarget` 的 Linux 目标单测不再假定必然是 reexec;CI runner 若带 systemd 环境变量时允许 supervisor-exit,具体模式由 `resolveProcessRestartTarget` 的独立测试覆盖。
|
|
6
|
+
|
|
7
|
+
### Tests
|
|
8
|
+
|
|
9
|
+
- 129 项测试;typecheck、build 全绿。
|
|
10
|
+
|
|
11
|
+
## [0.8.0] - 2026-11-22
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **Linux / Web / 云服务器重启与关闭**:重启目标从 Windows 桌面扩展到非 Windows Host 进程。systemd / Docker / Kubernetes / PID 1 使用 supervisor-exit(退出码 75);普通 `dsh web` 使用 detached reexec helper,等待旧 PID 退出后再启动同一 argv/cwd。可用 `DSH_MCVISERON_RESTART_MODE=reexec|supervisor-exit` 覆盖。
|
|
16
|
+
- **设置页「重启 / 关闭」**:状态显示 desktop / reexec / supervisor-exit;新增关闭 DSH 按钮;Linux/Web 下 `set_session_end_action` 的 restart/close 可用,OS 关机仍为 Windows-only。
|
|
17
|
+
- **文档**:新增 [docs/linux-restart.md](docs/linux-restart.md),包含 systemd、Docker、Kubernetes 和普通 CLI 的部署/停止策略。
|
|
18
|
+
|
|
19
|
+
### Tests
|
|
20
|
+
|
|
21
|
+
- 合计 **129 项测试**;typecheck、build 全绿。
|
|
22
|
+
|
|
1
23
|
## [Unreleased]
|
|
2
24
|
|
|
3
25
|
### 计划中
|
|
@@ -6,6 +28,69 @@
|
|
|
6
28
|
- 设置行支持「立即测试」预览按钮。
|
|
7
29
|
- Restart 组件支持 macOS/Linux(当前仅 Windows 桌面版)。
|
|
8
30
|
|
|
31
|
+
## [Unreleased]
|
|
32
|
+
|
|
33
|
+
### Docs
|
|
34
|
+
|
|
35
|
+
- 在 `docs/automation-tasks.md` 补充 Host Schedule 管理 API:0.2.2 的 `list({}) -> { items }`、`create(request, sessionId, signal)`、`edit({ id, action, patch }, sessionId, signal)`,以及旧版 `list({ sessionId })` / `create(sessionId, request)` / `update` / `delete` 的兼容层与 timing 映射;README 组件表加入文档链接。
|
|
36
|
+
|
|
37
|
+
## [0.7.8] - 2026-11-22
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
|
|
41
|
+
- **GitHub Actions Linux 测试失败**:`test/archive-integration.test.ts` 固定使用 Windows 临时目录,Linux runner 上 `mkdtemp` 失败。改为按 `TEMP` / `TMPDIR` / 平台默认目录选择,Windows 与 Linux 均可运行。
|
|
42
|
+
|
|
43
|
+
### Tests
|
|
44
|
+
|
|
45
|
+
- 合计 **126 项测试**;`pnpm install --frozen-lockfile`、typecheck、build 全绿。
|
|
46
|
+
|
|
47
|
+
## [0.7.7] - 2026-11-15
|
|
48
|
+
|
|
49
|
+
### Compatibility
|
|
50
|
+
|
|
51
|
+
- **预适配 DSH `0.2.2-rc.5`(nightly next)**:开发依赖升级到 0.2.2-rc.5,peer 范围加入 `^0.2.2-rc.5`,补齐 `dsh-error` rc.5 peer 图;当前桌面安装仍为 `0.2.2-rc.3`,真实运行时验证待桌面升级后补做。
|
|
52
|
+
- 复核 rc.5 的 Auto review 请求仍为 `purpose: auto-review` + 每条历史 JSON,0.7.6 的上下文裁剪逻辑兼容该格式。
|
|
53
|
+
|
|
54
|
+
### Tests
|
|
55
|
+
|
|
56
|
+
- 合计 **126 项测试**;typecheck、build 全绿。
|
|
57
|
+
|
|
58
|
+
## [0.7.6] - 2026-11-15
|
|
59
|
+
|
|
60
|
+
### Fixed
|
|
61
|
+
|
|
62
|
+
- **DSH 0.2.2 Auto review 请求未被裁剪**:0.2.2 把 reviewer 历史改成 `purpose: auto-review` + 每条消息一个 JSON 条目,旧版 `FILTERED_HISTORY` 检测永远不命中,长会话仍会 `CONTEXT_WINDOW_EXCEEDED`。现在按 `purpose` 识别新格式,保留 ENVIRONMENT、pending action、全部用户/父级指令、每种工具最新 schema 和最近 32 条;旧格式继续兼容。
|
|
63
|
+
- **上下文预算**:默认历史预算从 120k 提升到 200k 字符,旧工具参数/图片/超长 schema 继续压缩,减少长会话下 reviewer 丢失上下文。
|
|
64
|
+
|
|
65
|
+
### Tests
|
|
66
|
+
|
|
67
|
+
- 合计 **126 项测试**;typecheck、build 全绿。
|
|
68
|
+
|
|
69
|
+
## [0.7.5] - 2026-11-15
|
|
70
|
+
|
|
71
|
+
### Added
|
|
72
|
+
|
|
73
|
+
- **可选归档时间集成**:新增 Host 状态接口与「归档时间」设置子页;仅当 Loader 中存在已启用的第三方 `@linxin666/dsh-session-archive` 时注册/显示,未安装或禁用时不显示、不加载。页面显示归档台账统计(历史补记 / 正常记录 / 未知)并提供刷新。
|
|
74
|
+
- **不依赖第三方插件**:本插件不 import 归档插件;只通过 Loader 名称探测和台账文件读取提供可选状态。缺失时路由仍返回 `available:false`,客户端不注册标签页和组件行。
|
|
75
|
+
|
|
76
|
+
### Tests
|
|
77
|
+
|
|
78
|
+
- 合计 **124 项测试**;typecheck、build 全绿。
|
|
79
|
+
|
|
80
|
+
## [0.7.4] - 2026-11-15
|
|
81
|
+
|
|
82
|
+
### Compatibility
|
|
83
|
+
|
|
84
|
+
- **适配 DSH 0.2.2-rc.3 的 Schedule 管理 API**:list 返回分页 { items };create(request, sessionId, signal)、edit({ id, action, patch }, sessionId, signal) 取代旧的 create(sessionId, args) / update / delete。automation-tasks 同时兼容旧 API 与新 API,并保留旧工具参数到新 timing 的映射。
|
|
85
|
+
|
|
86
|
+
### Fixed
|
|
87
|
+
|
|
88
|
+
- **自动化任务列表/创建/修改/删除**:修复 0.2.2-rc.3 下 schedule.update is not a function、{ items } 分页形状和 schedule.edit 调用;新增现代 API 回归测试。
|
|
89
|
+
|
|
90
|
+
### Tests
|
|
91
|
+
|
|
92
|
+
- 合计 **122 项测试**;typecheck、build 全绿。
|
|
93
|
+
|
|
9
94
|
## [0.7.3] - 2026-11-15
|
|
10
95
|
|
|
11
96
|
### Compatibility
|
package/README.en.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
English | [中文](README.md)
|
|
4
4
|
|
|
5
|
-
MCviseron's **master plugin for DeepSeek Harness (DSH)**: one npm package and one `mcviseron` profile entry hosting
|
|
5
|
+
MCviseron's **master plugin for DeepSeek Harness (DSH)**: one npm package and one `mcviseron` profile entry hosting eight components. DSH `client-modules` only composes a browser half for a Loader row whose name exactly equals the package name, so the master entry must be `dsh-mcviseron-plugin`; components run as sub-plugins and own settings sub-pages. The former `dsh-auto-review-restart-fix` and `dsh-task-guard` are merged here and will be deprecated.
|
|
6
6
|
|
|
7
7
|
## Components
|
|
8
8
|
|
|
@@ -11,12 +11,13 @@ MCviseron's **master plugin for DeepSeek Harness (DSH)**: one npm package and on
|
|
|
11
11
|
| **Appearance · light/dark by time** | `mcviseron` top-level fields | Adds a settings row below DSH's Appearance row and switches the palette from the local wall clock |
|
|
12
12
|
| **Auto-review hardening** | `mcviseron.autoReviewFix` | Stops the whole-Host shutdown from persisting Full access over an Auto session; appends a Chinese translation to the manual-approval prompt |
|
|
13
13
|
| **Todo plan guard** | `mcviseron.taskGuard` | Advisory notices (optional hard stop) when multi-stage work stops updating its todo plan |
|
|
14
|
-
| **Restart
|
|
14
|
+
| **Restart / close DSH** | `mcviseron.restart` | Settings tab that restarts or closes the Windows desktop app or a Linux/Web/cloud DSH process (supervisor-exit or detached reexec); see [docs/linux-restart.md](docs/linux-restart.md) |
|
|
15
15
|
| **After-session action** | `mcviseron.sessionEnd` | “Restart after session” dropdown in the composer; the AI tool can arm it; restart waits for running tasks |
|
|
16
16
|
| **Auth-cookie cleanup** | built in | Expires old `dsh-auth-*` cookies on every page load, keeping only the current one so restarts cannot push the request header to 16 KB |
|
|
17
|
-
| **Automation task editing** | built-in tools | `automation_task_list/create/update/delete` call the Host schedule service and persist automatically |
|
|
17
|
+
| **Automation task editing** | built-in tools | `automation_task_list/create/update/delete` call the Host schedule service and persist automatically; see [docs/automation-tasks.md](docs/automation-tasks.md) for API compatibility |
|
|
18
|
+
| **Archive-time integration (optional)** | conditional | Shows the Archive time tab only when `@linxin666/dsh-session-archive` is detected; no registration when absent |
|
|
18
19
|
|
|
19
|
-
> 0.6.1 returns to a **single** `mcviseron` entry: DSH `client-modules` only composes a browser half for an exact package-name Loader row, and subpath rows silently dropped the whole client plugin. Components still run as sub-plugins and expose
|
|
20
|
+
> 0.6.1 returns to a **single** `mcviseron` entry: DSH `client-modules` only composes a browser half for an exact package-name Loader row, and subpath rows silently dropped the whole client plugin. Components still run as sub-plugins and expose Auto-review / Todo / session-end / conditional archive-time sub-pages.
|
|
20
21
|
|
|
21
22
|
### 1. Appearance · light/dark by time
|
|
22
23
|
|
|
@@ -43,9 +44,10 @@ MCviseron's **master plugin for DeepSeek Harness (DSH)**: one npm package and on
|
|
|
43
44
|
- **Step-intent detection** (`detectStepIntent`): watches the official `agent/assistant-stream` text/reasoning deltas for phrases such as "Now I will …" / "接下来我会 …" and matches them against pending todos. A match adds one targeted, advisory notice per step (with a ready-to-send `todo_write` JSON); a miss, a missing stream, or malformed data is silently skipped and never blocks the task.
|
|
44
45
|
- **Chinese todo display** (`translateTodoContent`): English todo titles in notices are batch-translated into "中文(English)" through the host `llm` service (cached per title, 3 s default timeout, original text on failure). Display only — the model's stored todo list is never rewritten.
|
|
45
46
|
|
|
46
|
-
### 4. Restart
|
|
47
|
+
### 4. Restart / close DSH
|
|
47
48
|
|
|
48
|
-
-
|
|
49
|
+
- Windows desktop: the **Restart / close** tab asks for confirmation and restarts or closes the desktop app.
|
|
50
|
+
- Linux / Web / cloud: a plain `dsh web` process uses a detached reexec helper; systemd / Docker / Kubernetes / PID 1 use supervisor-exit (code 75); close exits with code 0 and the deployment policy decides whether it restarts. See [docs/linux-restart.md](docs/linux-restart.md).
|
|
49
51
|
- A detached PowerShell helper closes the Electron main process; the Host performs its normal graceful shutdown when its IPC channel disconnects; the helper waits for both processes, clears `ELECTRON_RUN_AS_NODE`, and starts the application again.
|
|
50
52
|
- Running tasks are interrupted (same warning as the tray Quit); plugins, settings, and session records are not modified.
|
|
51
53
|
- Desktop-only: under `dsh web` the status route reports unavailable and the row hides.
|
|
@@ -81,7 +83,8 @@ Settings gains a first-level **MCviseron plugin** section (`settings.section`, i
|
|
|
81
83
|
|
|
82
84
|
- **Restart**: restart DeepSeek Harness (this component's settings).
|
|
83
85
|
- **After-session action**: enable switch, render grace, AI email reminder, subject/body templates.
|
|
84
|
-
- **
|
|
86
|
+
- **Archive time (conditional)**: shown only when the third-party archive plugin is detected; no registration when absent or disabled.
|
|
87
|
+
- **Components**: list the eight components and their configuration surfaces.
|
|
85
88
|
|
|
86
89
|
The Appearance component is intentionally **not** here — its row stays under General → Appearance. Auto review and Todo guard have editable sub-pages; the Components tab is an overview.
|
|
87
90
|
|
|
@@ -143,7 +146,7 @@ Defaults: appearance off / `08:00–23:00`; auto-review both guards on, 6 s, 400
|
|
|
143
146
|
## How it works
|
|
144
147
|
|
|
145
148
|
- `cordis.patch.yml` inserts one `mcviseron` master entry (`name: dsh-mcviseron-plugin`).
|
|
146
|
-
- `src/index.ts` mounts the
|
|
149
|
+
- `src/index.ts` mounts the eight components with `ctx.plugin`; each keeps its own `inject` and implementation.
|
|
147
150
|
- `src/appearance` owns the two loopback routes (`/api/dsh-mcviseron/settings/describe|mutate`) the browser uses; the browser half lives in `src/client/` and registers the settings section and sub-pages.
|
|
148
151
|
- The settings bridge accepts appearance top-level fields and nested `autoReviewFix.*` / `taskGuard.*` / `restart.*` / `sessionEnd.*` paths.
|
|
149
152
|
- The master entry and components unwrap DSH 0.2 volatile config references before use.
|
|
@@ -152,11 +155,12 @@ Defaults: appearance off / `08:00–23:00`; auto-review both guards on, 6 s, 400
|
|
|
152
155
|
|
|
153
156
|
| DSH version | Status |
|
|
154
157
|
| --- | --- |
|
|
155
|
-
| `0.2.2-rc.
|
|
156
|
-
| `0.2.2-rc.
|
|
157
|
-
| `0.2.
|
|
158
|
-
| `0.2.1-rc.
|
|
159
|
-
| `0.2.1-rc.
|
|
158
|
+
| `0.2.2-rc.5` | ✅ pre-adapted (0.2.2-rc.5 types/deps + 129 tests; current desktop still rc.3) |
|
|
159
|
+
| `0.2.2-rc.3` | ✅ current desktop (rc.3 types/deps + 129 tests; real runtime verified) |
|
|
160
|
+
| `0.2.2-rc.1` | ✅ compatible (0.2.2-rc.1 types/deps + 129 tests) |
|
|
161
|
+
| `0.2.1-rc.5` | ✅ compatible (rc.5 types/deps + 129 tests) |
|
|
162
|
+
| `0.2.1-rc.3` | ✅ compatible (rc.3 types/deps + 129 tests) |
|
|
163
|
+
| `0.2.1-rc.2` | ✅ current desktop runtime (129 tests + real Cordis contexts) |
|
|
160
164
|
| `0.2.0-rc.x` | ✅ covered by the peer range |
|
|
161
165
|
| `0.1.x` | ❌ unsupported (different settings-namespace model) |
|
|
162
166
|
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.en.md) | 中文
|
|
4
4
|
|
|
5
|
-
MCviseron 的 **DeepSeek Harness(DSH)总插件**:一个 npm 包、一个 `mcviseron` profile
|
|
5
|
+
MCviseron 的 **DeepSeek Harness(DSH)总插件**:一个 npm 包、一个 `mcviseron` profile 条目挂载八个组件。DSH 的 `client-modules` 只给 Loader 行名称精确等于包名的条目组合浏览器半区,因此 master 条目名必须是 `dsh-mcviseron-plugin`;组件作为子插件运行,设置页提供各自子页。原 `dsh-auto-review-restart-fix` 与 `dsh-task-guard` 已并入本插件并逐步废弃。
|
|
6
6
|
|
|
7
7
|
## 组件
|
|
8
8
|
|
|
@@ -11,12 +11,13 @@ MCviseron 的 **DeepSeek Harness(DSH)总插件**:一个 npm 包、一个 `
|
|
|
11
11
|
| **外观 · 按时间自动切换深浅色** | `mcviseron` 顶层字段 | 「设置 → 通用 → 外观」新增选项,按本机时间切换浅/深色 |
|
|
12
12
|
| **Auto review 修复** | `mcviseron.autoReviewFix` | 关机不再把 Auto 会话写成完全访问;人审提示追加中文译文 |
|
|
13
13
|
| **Todo 计划守卫** | `mcviseron.taskGuard` | 多阶段任务忘记更新 todo 时发出 notice(可选硬拦截) |
|
|
14
|
-
| **重启
|
|
14
|
+
| **重启 / 关闭 DSH** | `mcviseron.restart` | 「设置 → MCviseron 插件」里的重启/关闭按钮:Windows 桌面版重启应用;Linux/Web/云服务器使用 supervisor-exit 或 detached reexec |
|
|
15
15
|
| **会话后动作** | `mcviseron.sessionEnd` | 输入框左侧「会话后重启」下拉;AI 工具可设置;重启等待任务结束 |
|
|
16
16
|
| **认证 cookie 清理** | 内置 | 每次页面加载过期旧 `dsh-auth-*`,只保留当前,避免重启把请求头推到 16KB |
|
|
17
|
-
| **自动化任务编辑** | 内置工具 | `automation_task_list/create/update/delete` 直接调用 Host schedule
|
|
17
|
+
| **自动化任务编辑** | 内置工具 | `automation_task_list/create/update/delete` 直接调用 Host schedule 并自动存盘;API 兼容说明见 [docs/automation-tasks.md](docs/automation-tasks.md) |
|
|
18
|
+
| **归档时间集成(可选)** | 条件注册 | 仅检测到 `@linxin666/dsh-session-archive` 时显示「归档时间」子页;未安装不注册 |
|
|
18
19
|
|
|
19
|
-
> 0.6.1 起回到**单一** `mcviseron` 条目:DSH `client-modules` 只给精确包名条目组合浏览器半区,子路径条目会让整个客户端插件(外观行、设置分区、重启回退)消失。组件仍在内部作为子插件运行,设置页有 Auto review / Todo
|
|
20
|
+
> 0.6.1 起回到**单一** `mcviseron` 条目:DSH `client-modules` 只给精确包名条目组合浏览器半区,子路径条目会让整个客户端插件(外观行、设置分区、重启回退)消失。组件仍在内部作为子插件运行,设置页有 Auto review / Todo / 会话后动作 / 条件归档时间子页。
|
|
20
21
|
|
|
21
22
|
### 1. 外观 · 按时间自动切换深浅色
|
|
22
23
|
|
|
@@ -30,7 +31,7 @@ MCviseron 的 **DeepSeek Harness(DSH)总插件**:一个 npm 包、一个 `
|
|
|
30
31
|
|
|
31
32
|
1. **关机预设守卫**:Auto review 在卸载时会调用 `permissionPresets.set` 把仍处于 Auto 的会话改成 `danger-full-access`。整套宿主退出时这是错误落盘;组件在根 Cordis fiber 不是 `ACTIVE` 时丢弃该写入(运行中移除插件仍然照常迁移)。
|
|
32
33
|
2. **审批理由中文译文**:自动审查拒绝并转人工审批时,`displayReason` 里的英文审查理由原样保留,只在本地化文本末尾追加 `【审查理由 · 中文翻译】` 段落;同时把同一段译文追加到 `reason` 末尾(审计原文保持开头不变),让只读取 `approval/asked` 的邮箱兜底也能收到译文。
|
|
33
|
-
3. **reviewer 上下文裁剪**:长会话不再把整段历史塞进 Auto review 模型;只包装 reviewer 的 `llm.stream`,保留当前动作、工程约束和全部人类指令,旧工具调用/图片/超长参数压缩,默认历史上限
|
|
34
|
+
3. **reviewer 上下文裁剪**:长会话不再把整段历史塞进 Auto review 模型;只包装 reviewer 的 `llm.stream`,保留当前动作、工程约束和全部人类指令,旧工具调用/图片/超长参数压缩,默认历史上限 200k 字符,保留最近 32 条。详见 [docs/auto-review-context.md](docs/auto-review-context.md)。
|
|
34
35
|
4. **转手动被拒理由回传**:当 `approval.request` 返回 `rejected` 且该审批来自 Auto review 时,组件把自动审查理由(含译文)作为 `plugin:auto-review-fix` notice 附到该工具结果的 `additionalContexts`;AI 下一次就能看到「为什么被拒」,而不是只看到 `the user rejected tool ...`。注意:DSH 审批面板目前没有人类理由输入框,回传的是自动审查理由。
|
|
35
36
|
|
|
36
37
|
翻译使用当前会话的 provider/model 再发一次短请求(可选固定 provider/model),按原文缓存(进程内,上限 256),超时 6 秒可配。**任何失败都原样放行审批**:没有 `llm`、没有会话路由、宿主没有 `displayReason`、超时、模型报错——都不会阻塞审批,也不会改写审查文本。
|
|
@@ -47,9 +48,10 @@ MCviseron 的 **DeepSeek Harness(DSH)总插件**:一个 npm 包、一个 `
|
|
|
47
48
|
- **中文 todo 展示**(`translateTodoContent`):notice 里的英文 todo 标题会经 `llm` 批量翻译成「中文(English)」显示,按标题缓存、超时 3 秒可配;翻译失败就显示原文。notice 里还会提示「todo 内容可以直接用中文书写」。**只影响 notice 展示,不改写模型写入的 todo 列表**。
|
|
48
49
|
- notice 的 source kind 按会话格式自动选择:v4 用 `plugin:task-guard`,v3 用 `plugin` + `plugin: 'task-guard'`。
|
|
49
50
|
|
|
50
|
-
### 4. 重启
|
|
51
|
+
### 4. 重启 / 关闭 DSH
|
|
51
52
|
|
|
52
|
-
-
|
|
53
|
+
- Windows 桌面版:「设置 → MCviseron 插件 → 重启 / 关闭」子页提供重启与关闭按钮,点击后确认并重启/关闭桌面应用。
|
|
54
|
+
- Linux / Web / 云服务器:普通 `dsh web` 使用 detached reexec;systemd / Docker / Kubernetes / PID 1 使用 supervisor-exit(退出码 75);关闭使用 exit 0,保持停止还是被托管器拉起由部署策略决定。详见 [docs/linux-restart.md](docs/linux-restart.md)。
|
|
53
55
|
- 重启方式:Host 写一个临时 PowerShell 助手(detached),先关闭 Electron 主进程;Host 在 IPC 断开后按官方流程优雅关闭所有插件与会话;助手等待主进程与 Host 退出后,清除 `ELECTRON_RUN_AS_NODE` 并重新启动应用。
|
|
54
56
|
- 会中断正在运行的任务(与托盘「退出」的提示一致),不会修改插件、配置或会话记录。
|
|
55
57
|
- 只在桌面版可用;`dsh web` 下状态接口返回不可用,设置行自动隐藏。
|
|
@@ -84,9 +86,10 @@ MCviseron 的 **DeepSeek Harness(DSH)总插件**:一个 npm 包、一个 `
|
|
|
84
86
|
|
|
85
87
|
设置里新增一个一级分区 **「MCviseron 插件」**(`settings.section`,id `mcviseron`),组件按需在这里拥有子页:
|
|
86
88
|
|
|
87
|
-
-
|
|
89
|
+
- **重启 / 关闭**:Windows 桌面版重启 Electron;Linux/Web 按进程模式重启或关闭(见 [docs/linux-restart.md](docs/linux-restart.md))。
|
|
88
90
|
- **会话后动作**:启用开关、显示等待、AI 邮件提醒、邮件主题/正文模板。
|
|
89
|
-
-
|
|
91
|
+
- **归档时间(条件)**:检测到第三方归档插件时显示;未安装或禁用时不注册、不显示。
|
|
92
|
+
- **组件**:列出八个组件及其配置位置。
|
|
90
93
|
|
|
91
94
|
外观组件**不在**这里——它的设置行仍留在「通用 → 外观」,位置不变。没有设置面的组件不占用子页;`autoReview` / `taskGuard` 继续通过 profile 配置,组件子页会注明这一点。
|
|
92
95
|
|
|
@@ -220,7 +223,7 @@ pnpm add dsh-mcviseron-plugin
|
|
|
220
223
|
name: dsh-mcviseron-plugin
|
|
221
224
|
```
|
|
222
225
|
|
|
223
|
-
包根导出 `.` → `lib/index.js`。`src/index.ts` 的 `apply()` 用 `ctx.plugin`
|
|
226
|
+
包根导出 `.` → `lib/index.js`。`src/index.ts` 的 `apply()` 用 `ctx.plugin` 依次挂载八个子组件,每个子组件保留自己的 `inject`、`Config` 与实现;设置页由 `src/client/` 注册。
|
|
224
227
|
|
|
225
228
|
### 组件装配
|
|
226
229
|
|
|
@@ -228,7 +231,7 @@ pnpm add dsh-mcviseron-plugin
|
|
|
228
231
|
- `src/appearance/index.ts`:只有 Host 设置桥(`ctx.settings.configure({ auto: false })` + 两条 loopback 路由);浏览器半边在 `src/client/`,读取 `mcviseron` 命名空间并驱动 `ctx.theme.setTheme`。
|
|
229
232
|
- `src/auto-review-fix/index.ts`:`installAutoReview`,通过 `ctx.inject(['permissionPresets' | 'approval'])` 特性探测并包装服务。
|
|
230
233
|
- `src/task-guard/index.ts`:`installTaskGuard`,注册 `tools/pre-execute`、`tools/post-execute`、`agent/pre-step`、`session/event`。
|
|
231
|
-
- master
|
|
234
|
+
- master 与八个子组件都会先 `toPlain()` 展开 DSH 0.2 的 volatile 配置引用,再交给实现。
|
|
232
235
|
|
|
233
236
|
### 设置桥
|
|
234
237
|
|
|
@@ -247,11 +250,12 @@ DSH 0.2 的官方设置 apiproxy 不向浏览器暴露第三方命名空间,
|
|
|
247
250
|
|
|
248
251
|
| DSH 版本 | 状态 |
|
|
249
252
|
| --- | --- |
|
|
250
|
-
| `0.2.2-rc.
|
|
251
|
-
| `0.2.2-rc.
|
|
252
|
-
| `0.2.
|
|
253
|
-
| `0.2.1-rc.
|
|
254
|
-
| `0.2.1-rc.
|
|
253
|
+
| `0.2.2-rc.5` | ✅ 预适配(0.2.2-rc.5 类型/依赖 + 129 项测试;当前桌面仍为 rc.3) |
|
|
254
|
+
| `0.2.2-rc.3` | ✅ 当前桌面安装(rc.3 类型/依赖 + 129 项测试;真实运行时验证) |
|
|
255
|
+
| `0.2.2-rc.1` | ✅ 兼容(0.2.2-rc.1 类型/依赖 + 129 项测试) |
|
|
256
|
+
| `0.2.1-rc.5` | ✅ 兼容(rc.5 类型/依赖 + 129 项测试) |
|
|
257
|
+
| `0.2.1-rc.3` | ✅ 兼容(rc.3 类型/依赖 + 129 项测试) |
|
|
258
|
+
| `0.2.1-rc.2` | ✅ 当前桌面运行版本(129 项测试 + 真实 Cordis 上下文) |
|
|
255
259
|
| `0.2.0-rc.x` | ✅ peer 范围覆盖(同一套设置、审批与 hook 接缝) |
|
|
256
260
|
| `0.1.x` | ❌ 不支持:0.1 的插件自行注册设置命名空间,与本插件的条目 id 命名空间模型不同 |
|
|
257
261
|
|
|
@@ -281,7 +285,7 @@ src/
|
|
|
281
285
|
volatile.ts 展开 DSH volatile 配置引用
|
|
282
286
|
loopback.ts loopback 信任栅栏
|
|
283
287
|
routes.ts settings describe/mutate 桥(含嵌套组件路径)
|
|
284
|
-
index.ts master 条目:Config +
|
|
288
|
+
index.ts master 条目:Config + 挂载八个子组件
|
|
285
289
|
appearance/index.ts 外观子组件:设置桥
|
|
286
290
|
auto-review-fix/index.ts Auto review 子组件:Config + 装配
|
|
287
291
|
task-guard/index.ts Todo 守卫子组件:Config + 装配
|
|
@@ -317,7 +321,7 @@ test/
|
|
|
317
321
|
|
|
318
322
|
```bash
|
|
319
323
|
pnpm install
|
|
320
|
-
pnpm check # typecheck +
|
|
324
|
+
pnpm check # typecheck + 129 项测试 + 构建
|
|
321
325
|
```
|
|
322
326
|
|
|
323
327
|
构建产物:`lib/index.js`(master ESM)、`lib/appearance.js`、`lib/auto-review-fix.js`、`lib/task-guard.js`、`lib/restart.js` 与 `lib/client.js`(浏览器模块)。`lib/` 不入库。
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Optional archive-time integration
|
|
2
|
+
|
|
3
|
+
The MCviseron settings section includes an **Archive time** tab only when the
|
|
4
|
+
third-party `@linxin666/dsh-session-archive` plugin is mounted and enabled.
|
|
5
|
+
|
|
6
|
+
## Detection
|
|
7
|
+
|
|
8
|
+
The Host route `/api/dsh-mcviseron/archive-integration/status` scans the Cordis
|
|
9
|
+
Loader entries for an enabled entry whose name contains `session-archive`.
|
|
10
|
+
The client requests this route when the settings section mounts and renders the
|
|
11
|
+
tab plus the Components row only when `available === true`.
|
|
12
|
+
|
|
13
|
+
No import, package dependency, or static profile entry references the
|
|
14
|
+
third-party plugin, so uninstalling or disabling it removes the tab with no
|
|
15
|
+
error and no empty settings page.
|
|
16
|
+
|
|
17
|
+
## Status
|
|
18
|
+
|
|
19
|
+
When available, the tab reports:
|
|
20
|
+
|
|
21
|
+
- archived session count from `workspaceRegistry.archivedSessionIds`;
|
|
22
|
+
- ledger entries counts;
|
|
23
|
+
- historical `observed` (backfilled) vs normal `manual` records;
|
|
24
|
+
- unknown archive times;
|
|
25
|
+
- ledger path.
|
|
26
|
+
|
|
27
|
+
Historical unknown times are backfilled only during the first initialization;
|
|
28
|
+
archives after initialization are recorded as normal archive times. Auto-delete
|
|
29
|
+
remains controlled by the third-party plugin and is off by default.
|
|
@@ -2,42 +2,43 @@
|
|
|
2
2
|
|
|
3
3
|
## 问题
|
|
4
4
|
|
|
5
|
-
DSH 的 `dsh-experimental-auto-review`
|
|
6
|
-
`
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
长会话会超过 reviewer 的上下文窗口:
|
|
5
|
+
DSH 0.2.2 的 `dsh-experimental-auto-review` 会把当前 Session 的完整
|
|
6
|
+
`surface.nodes` 转成 review 请求,再送给 reviewer 模型。长会话会超过 reviewer
|
|
7
|
+
的上下文窗口,Auto review 在审批之前就失败:
|
|
10
8
|
|
|
11
9
|
```text
|
|
12
10
|
CONTEXT_WINDOW_EXCEEDED: max 1048576, requested 1051891
|
|
13
|
-
(795891 in messages, 256000 in completion)
|
|
14
11
|
```
|
|
15
12
|
|
|
16
|
-
这不是人工审批弹窗的问题,而是
|
|
13
|
+
这不是人工审批弹窗的问题,而是 reviewer 的 LLM 请求过大。
|
|
17
14
|
|
|
18
15
|
## 修复
|
|
19
16
|
|
|
20
|
-
`auto-review-fix` 包装 `llm.stream
|
|
17
|
+
`auto-review-fix` 包装 `llm.stream`,只改写真正的 Auto review 请求:
|
|
21
18
|
|
|
22
|
-
-
|
|
23
|
-
-
|
|
19
|
+
- `purpose === 'auto-review'`;
|
|
20
|
+
- `system` 同时包含 `REVIEW_POLICY` 和 `final authorization reviewer`;
|
|
21
|
+
- `messages[0]` 以 `ENVIRONMENT\n` 开头,后续每条消息是一个历史条目 JSON。
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
0.2.1/旧版使用的 `FILTERED_HISTORY` / `PENDING_ACTION` 单消息格式仍兼容。
|
|
26
24
|
|
|
27
25
|
### 保留什么
|
|
28
26
|
|
|
29
|
-
- `
|
|
30
|
-
-
|
|
31
|
-
- 所有 `
|
|
32
|
-
|
|
27
|
+
- `ENVIRONMENT`:原样保留。
|
|
28
|
+
- 最后一条消息(pending action):原样保留,评审对象不能裁剪。
|
|
29
|
+
- 所有 `user-instruction` / `direct-parent-instruction` / `constraint` /
|
|
30
|
+
`checkpoint`:保留,长文本最多 8,000 字符。
|
|
31
|
+
- 每种工具的最新 schema:保留,保证 reviewer 知道 pending call 的参数含义。
|
|
32
|
+
- 最近 `reviewKeepRecentEntries` 条历史(默认 32)。
|
|
33
33
|
|
|
34
34
|
### 压缩什么
|
|
35
35
|
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
36
|
+
- 旧工具调用参数:最多 4,000 字符;
|
|
37
|
+
- 旧用户/事实文本:最多 8,000 字符;
|
|
38
|
+
- schema description:最多 4,000 字符;
|
|
39
|
+
- 旧图片和附件:移除 base64,只留占位文本;
|
|
40
|
+
- 被省略的旧条目:插入一条 JSON summary,不破坏每消息一个 JSON 的格式;
|
|
41
|
+
- 历史总预算:默认 200,000 字符。
|
|
41
42
|
|
|
42
43
|
裁剪只作用于 reviewer 的请求副本,不修改会话历史、审计事件或当前工具调用。
|
|
43
44
|
|
|
@@ -47,8 +48,8 @@ CONTEXT_WINDOW_EXCEEDED: max 1048576, requested 1051891
|
|
|
47
48
|
|
|
48
49
|
```yaml
|
|
49
50
|
reviewContextGuard: true
|
|
50
|
-
reviewMaxHistoryChars:
|
|
51
|
-
reviewKeepRecentEntries:
|
|
51
|
+
reviewMaxHistoryChars: 200000
|
|
52
|
+
reviewKeepRecentEntries: 32
|
|
52
53
|
```
|
|
53
54
|
|
|
54
55
|
## 边界
|
|
@@ -60,6 +61,6 @@ reviewKeepRecentEntries: 16
|
|
|
60
61
|
|
|
61
62
|
## 测试
|
|
62
63
|
|
|
63
|
-
`test/review-context.test.ts`
|
|
64
|
-
|
|
64
|
+
`test/review-context.test.ts` 覆盖旧版和新版两种请求格式、pending action 保留、
|
|
65
|
+
人类指令保留、schema 保留、图片/工具参数裁剪、畸形 JSON 原样返回,以及 wrapper
|
|
65
66
|
只改写 reviewer 调用。
|
package/docs/automation-task.md
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
3. 若发布了新版本:
|
|
39
39
|
a. 执行 pnpm install,把 @deepseek-ai/dsh-client-connection、dsh-client-locale、dsh-client-ui-settings、dsh-client-ui-slots、dsh-client-ui-renderer、dsh-host-webserver、dsh-settings、@deepseek-ai/cordis 的开发依赖升级到与最新 DSH 相同版本,并更新 peerDependencies 范围。
|
|
40
40
|
b. 对照最新包的类型声明与 lib 实现,按组件逐层修复不兼容处(先 Host 设置桥,再 autoReview、taskGuard,最后浏览器外观行)。
|
|
41
|
-
c. 执行 pnpm check(tsc --noEmit +
|
|
41
|
+
c. 执行 pnpm check(tsc --noEmit + 122 项 node 测试 + esbuild 构建),补齐或修正测试;必要时更新 test/plugin.test.ts 的装配断言。
|
|
42
42
|
d. 更新 CHANGELOG.md(新版本段落记录兼容版本与修复)、README.md / README.en.md 的兼容性表;提交并推送到 main。
|
|
43
43
|
4. 不要执行 npm publish;不要重启或关闭正在运行的 DSH;不要修改 D:\Program\DSH-Plugin-Class 下的其他插件仓库。
|
|
44
44
|
|
package/docs/automation-tasks.md
CHANGED
|
@@ -27,6 +27,55 @@ DSH 官方的 `schedule_create/list/update/delete` 只在声明了
|
|
|
27
27
|
- `weekly`:`{ time, time_zone, weekdays }`;
|
|
28
28
|
- `cron`:`{ expression, time_zone }`。
|
|
29
29
|
|
|
30
|
+
## Host Schedule 管理 API
|
|
31
|
+
|
|
32
|
+
组件不直接编辑 `schedule.json`,只调用 Host 的 `ctx.schedule` 服务。DSH 0.2.2
|
|
33
|
+
与旧版接口不同,组件用 `typeof schedule.edit === 'function'` 探测并分层适配:
|
|
34
|
+
|
|
35
|
+
### DSH 0.2.2+
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
// 列表:分页信封
|
|
39
|
+
const page = await schedule.list({}, exec.signal)
|
|
40
|
+
// page.items: ScheduleTask[]
|
|
41
|
+
|
|
42
|
+
// 创建:request 带 target,sessionId 作为绑定参数
|
|
43
|
+
const task = await schedule.create({
|
|
44
|
+
title: '...',
|
|
45
|
+
prompt: '...',
|
|
46
|
+
timing: { kind: 'weekly', weekly: { time: '09:00', time_zone: 'Asia/Shanghai', weekdays: [6] } },
|
|
47
|
+
target: { kind: 'session', sessionId },
|
|
48
|
+
}, sessionId, exec.signal)
|
|
49
|
+
|
|
50
|
+
// 修改 / 删除:统一走 edit
|
|
51
|
+
await schedule.edit({ id, action: 'update', patch }, sessionId, exec.signal)
|
|
52
|
+
await schedule.edit({ id, action: 'delete' }, sessionId, exec.signal)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 旧版 API
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
const tasks = await schedule.list({ sessionId }, exec.signal) // ScheduleTask[]
|
|
59
|
+
const task = await schedule.create(sessionId, request, exec.signal)
|
|
60
|
+
await schedule.update(sessionId, id, patch, exec.signal)
|
|
61
|
+
await schedule.delete(sessionId, id, exec.signal)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 工具参数到 timing 的映射
|
|
65
|
+
|
|
66
|
+
| 工具参数 | Host timing |
|
|
67
|
+
|---|---|
|
|
68
|
+
| `after_seconds` | `{ kind: 'after', after_seconds }` |
|
|
69
|
+
| `at` | `{ kind: 'at', at }` |
|
|
70
|
+
| `every_seconds` | `{ kind: 'every', every_seconds }` |
|
|
71
|
+
| `daily` | `{ kind: 'daily', daily }` |
|
|
72
|
+
| `weekly` | `{ kind: 'weekly', weekly }` |
|
|
73
|
+
| `cron` | `{ kind: 'cron', cron }` |
|
|
74
|
+
|
|
75
|
+
`listRecords()` 同时接受 `ScheduleTask[]` 和 `{ items: ScheduleTask[] }`,避免
|
|
76
|
+
0.2.2 升级后 `.find is not a function`。旧 API 的 update/delete 只在新 API 缺失时
|
|
77
|
+
才使用。
|
|
78
|
+
|
|
30
79
|
## 自动存盘
|
|
31
80
|
|
|
32
81
|
工具直接调用 `ctx.schedule`;该方法负责持久化,和官方自动化任务 UI 使用同一个
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Linux / Web / 云服务器上的重启与关闭
|
|
2
|
+
|
|
3
|
+
Windows 桌面版继续使用 Electron 主进程 + Task Scheduler 的原地重启;Linux、Web 与云服务器使用 Host 进程级方案。
|
|
4
|
+
|
|
5
|
+
## 目标解析
|
|
6
|
+
|
|
7
|
+
`resolveRestartTarget()` 在非 Windows 平台返回 ProcessTarget:
|
|
8
|
+
|
|
9
|
+
- `execPath`:`process.execPath`(通常是 node);
|
|
10
|
+
- `argv`:`process.execArgv` + `process.argv.slice(1)`,即当前 dsh 命令及参数;
|
|
11
|
+
- `cwd`:当前工作目录;
|
|
12
|
+
- `mode`:`reexec` 或 `supervisor-exit`。
|
|
13
|
+
|
|
14
|
+
### supervisor-exit
|
|
15
|
+
|
|
16
|
+
以下任一条件成立时,重启请求只退出 Host,由外层托管器拉起:
|
|
17
|
+
|
|
18
|
+
- systemd:`INVOCATION_ID` / `JOURNAL_STREAM` / `SYSTEMD_EXEC_PID`;
|
|
19
|
+
- Kubernetes:`KUBERNETES_SERVICE_HOST`;
|
|
20
|
+
- Docker:存在 `/.dockerenv`;
|
|
21
|
+
- 进程 PID 为 1(容器入口);
|
|
22
|
+
- `DSH_MCVISERON_RESTART_MODE=supervisor-exit`(或 `exit`)。
|
|
23
|
+
|
|
24
|
+
退出码为 **75**(`EX_TEMPFAIL`),便于 `Restart=on-failure` / Docker `on-failure` 识别为需要重启。
|
|
25
|
+
|
|
26
|
+
### reexec
|
|
27
|
+
|
|
28
|
+
普通 `dsh web` 进程:
|
|
29
|
+
|
|
30
|
+
1. 写入一个 detached Node helper;
|
|
31
|
+
2. helper 等待原 PID 退出;
|
|
32
|
+
3. helper 用相同 `execPath`、argv、cwd 和环境启动新进程;
|
|
33
|
+
4. 原进程退出。
|
|
34
|
+
|
|
35
|
+
helper 会最多等待原进程 30 秒,避免端口未释放就启动新实例。可用
|
|
36
|
+
`DSH_MCVISERON_RESTART_MODE=reexec` 强制该模式。
|
|
37
|
+
|
|
38
|
+
## 关闭
|
|
39
|
+
|
|
40
|
+
关闭请求执行 `process.exit(0)`(桌面版关闭 Electron 主进程),不再启动新进程。
|
|
41
|
+
关闭后是否真正保持停止,由托管器策略决定:
|
|
42
|
+
|
|
43
|
+
### systemd
|
|
44
|
+
|
|
45
|
+
```ini
|
|
46
|
+
[Service]
|
|
47
|
+
ExecStart=/usr/bin/dsh web --host 0.0.0.0 --port 3000
|
|
48
|
+
Restart=on-failure
|
|
49
|
+
RestartSec=3
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
- 重启:进程以 75 退出,systemd 重新拉起;
|
|
53
|
+
- 关闭:进程以 0 退出,systemd 不再拉起。
|
|
54
|
+
|
|
55
|
+
### Docker
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
docker run --restart on-failure ...
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- 重启:75 退出,Docker 重新拉起;
|
|
62
|
+
- 关闭:0 退出,保持停止。
|
|
63
|
+
- 若使用 `--restart unless-stopped`,关闭也会被 Docker 重新拉起;这是 Docker 策略,不是插件能覆盖的。
|
|
64
|
+
|
|
65
|
+
### Kubernetes
|
|
66
|
+
|
|
67
|
+
```yaml
|
|
68
|
+
restartPolicy: OnFailure
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
- 重启:75 退出,kubelet 重启容器;
|
|
72
|
+
- 关闭:0 退出,Pod 保持 Completed。
|
|
73
|
+
- `restartPolicy: Always` 下关闭也会被重新拉起;需要停止时使用 `kubectl delete pod` 或调整策略。
|
|
74
|
+
|
|
75
|
+
### 普通 CLI
|
|
76
|
+
|
|
77
|
+
直接运行 `dsh web` 时使用 reexec helper;关闭后进程直接结束,不会被重新拉起。
|
|
78
|
+
|
|
79
|
+
## 设置页与会话后动作
|
|
80
|
+
|
|
81
|
+
- 「重启 / 关闭」设置页同时提供重启与关闭按钮;
|
|
82
|
+
- 状态会显示当前模式(desktop / reexec / supervisor-exit);
|
|
83
|
+
- `set_session_end_action` 的 `restart` / `close` 在 Linux/Web 同样可用;
|
|
84
|
+
- 操作系统关机仍是 Windows-only,Linux 上不提供。
|
|
85
|
+
|
|
86
|
+
## 安全与限制
|
|
87
|
+
|
|
88
|
+
- 路由仍只接受 loopback 请求并需要 `confirm: true`;
|
|
89
|
+
- 重启不会执行任意命令,只复用当前进程的 `execPath`、argv、cwd;
|
|
90
|
+
- supervisor-exit 依赖托管器配置;没有托管器的环境应使用 reexec;
|
|
91
|
+
- reexec 需要当前进程有权限启动新进程;容器内建议使用 supervisor-exit;
|
|
92
|
+
- 日志:`$TMPDIR/dsh-mcviseron-restart.log`(Windows 为 `%TEMP%`)。
|
|
93
|
+
|
|
94
|
+
## 测试
|
|
95
|
+
|
|
96
|
+
`test/restart.test.ts` 覆盖 Windows 桌面目标、Linux reexec/supervisor 探测、环境变量覆盖、状态/执行路由与关闭动作;`test/session-end.test.ts` 覆盖 Linux 的 restart/close 可用性。
|