dsh-mcviseron-plugin 0.6.5 → 0.6.6
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 +16 -0
- package/README.en.md +16 -4
- package/README.md +18 -6
- package/docs/auth-cookie.md +61 -0
- package/docs/auto-review-context.md +65 -0
- package/docs/automation-task.md +1 -1
- package/docs/release.md +3 -3
- package/docs/session-end.md +4 -1
- package/lib/auto-review-fix.js +253 -23
- package/lib/client.js +199 -9
- package/lib/index.js +546 -116
- package/package.json +3 -3
- package/src/api.ts +6 -0
- package/src/auth-cookie/index.ts +175 -0
- package/src/auto-review-fix/index.ts +9 -0
- package/src/client/ConfigForm.tsx +3 -0
- package/src/client/SessionEndControl.tsx +3 -0
- package/src/client/SessionEndGlobalNotice.ts +183 -0
- package/src/client/SettingsSection.tsx +4 -0
- package/src/client/index.ts +15 -0
- package/src/client/locales.ts +14 -0
- package/src/components/auto-review-fix/index.ts +8 -0
- package/src/components/auto-review-fix/review-context.ts +285 -0
- package/src/index.ts +2 -0
- package/src/session-end/index.ts +72 -8
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,22 @@
|
|
|
7
7
|
- Restart 组件支持 macOS/Linux(当前仅 Windows 桌面版)。
|
|
8
8
|
- 把定时巡检任务 prompt 更新为当前单条目架构。
|
|
9
9
|
|
|
10
|
+
## [0.6.6] - 2026-10-23
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **AI 会话后动作全局提示**:右上角固定提示「xx 会话已启用 AI 会话自动重启/关闭」,多会话多张可关闭卡片;只显示 AI 设置的动作,动作执行/清除后消失。提示位于导航栏下方并保留间距,新动作通过 `armedAt` 重新显示。
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- **多会话会话后动作重复执行**:多个会话同时设置 restart/close 时,旧实现会各自排队并发起多个重启任务。现在进程级 `dispatching` 锁只允许第一个进入执行阶段的动作,取消其它会话的计时器和状态。
|
|
19
|
+
- **Auto review 长会话无法审批**:DSH reviewer 会把整个 `FILTERED_HISTORY` 送进模型,长会话触发 `CONTEXT_WINDOW_EXCEEDED`。`auto-review-fix` 现在只包装 Auto review 的 `llm.stream` 请求:保留 PENDING_ACTION、工程约束和全部人类指令,旧工具调用折叠,图片/超长参数裁剪,历史上限默认 120k 字符;普通对话和翻译请求不受影响。
|
|
20
|
+
- **DSH 重启认证 cookie 累积**:DSH 每次随机端口都会在 `127.0.0.1` 下留下新的 `dsh-auth-*`,Chromium 不按端口隔离,30 天后累积到 16 KB 请求头上限并触发 431。新增 `auth-cookie` 组件:Host 路由 + index head 脚本 + 客户端兜底,在每次页面加载时过期所有旧 `dsh-auth-*`,只保留当前 authority 的 cookie。不限制重启,不修改 `app.asar`,DSH 升级不会丢失。
|
|
21
|
+
|
|
22
|
+
### Tests
|
|
23
|
+
|
|
24
|
+
- 合计 **112 项测试**。
|
|
25
|
+
|
|
10
26
|
## [0.6.5] - 2026-10-23
|
|
11
27
|
|
|
12
28
|
### Added
|
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 six 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
|
|
|
@@ -13,6 +13,7 @@ MCviseron's **master plugin for DeepSeek Harness (DSH)**: one npm package and on
|
|
|
13
13
|
| **Todo plan guard** | `mcviseron.taskGuard` | Advisory notices (optional hard stop) when multi-stage work stops updating its todo plan |
|
|
14
14
|
| **Restart DeepSeek Harness** | `mcviseron.restart` | Button in Settings → MCviseron plugin that closes and relaunches the desktop application |
|
|
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
|
+
| **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 |
|
|
16
17
|
|
|
17
18
|
> 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 settings sub-pages.
|
|
18
19
|
|
|
@@ -26,6 +27,7 @@ MCviseron's **master plugin for DeepSeek Harness (DSH)**: one npm package and on
|
|
|
26
27
|
### 2. Auto-review hardening
|
|
27
28
|
|
|
28
29
|
- Drops `permissionPresets.set` writes while the root Cordis fiber is not `ACTIVE`, so a whole-Host shutdown no longer migrates Auto sessions to Full access.
|
|
30
|
+
- Bounds the Auto-review context: wraps only the reviewer `llm.stream` call, keeps the pending action, project constraints and every human instruction, compacts old tool calls/images/oversized arguments, and caps history at 120k chars by default. See [docs/auto-review-context.md](docs/auto-review-context.md).
|
|
29
31
|
- Appends a `【审查理由 · 中文翻译】` block to the localized `displayReason` and to the audited `reason` (original text stays as the prefix); `displayReason.en` stays byte-identical.
|
|
30
32
|
- Translation uses the session's provider/model (or a pinned pair), caches per source string (256 entries), times out after 6 s, and passes the approval through unchanged on any failure.
|
|
31
33
|
- A reviewer note that is predominantly Chinese is never translated again; an English note that merely quotes Chinese or contains a Chinese path is still translated.
|
|
@@ -51,19 +53,29 @@ MCviseron's **master plugin for DeepSeek Harness (DSH)**: one npm package and on
|
|
|
51
53
|
### 5. After-session action
|
|
52
54
|
|
|
53
55
|
- A **“Restart after session”** dropdown left of the composer: No action / Restart DSH / Close DSH / Shut down PC. It starts with No action on every DSH launch.
|
|
54
|
-
- Runs once after the final reply has fully rendered (3 s grace by default); sending a new message during the grace
|
|
56
|
+
- Runs once after the final reply has fully rendered (3 s grace by default); sending a new message during the grace keeps the action and reschedules it to the end of that turn.
|
|
55
57
|
- The AI can arm **restart** or **close DSH** through `set_session_end_action` (never shutdown). The composer shows a colored, non-modal reminder; shutdown is user-only.
|
|
56
58
|
- **Restart performs a task probe**: it waits while any agent turn (including one waiting for approval/answer) or background job is running, then restarts. Close/shutdown do not wait. **The Settings restart button is not affected** and still runs immediately.
|
|
57
59
|
- State is in Host memory and one-shot; it is cleared before launch, so a fresh process, plugin load, or repeated turn/end cannot cause a restart loop.
|
|
60
|
+
- **Global arbitration**: the first action that reaches execution sets a process-wide dispatching lock, clears every other session's timer/action, and is the only process action dispatched; two sessions arming restart produce one restart.
|
|
61
|
+
- **Global AI notice**: besides the composer reminder, a fixed top-right notice shows "session X enabled AI session auto-restart/close"; multiple sessions render multiple dismissible cards, which disappear when the action runs or is cleared. User-set actions do not show this AI notice.
|
|
58
62
|
- **Email link**: if `dsh-email-notify` is installed and configured sendable, arming the action reuses its SMTP settings to send one reminder; the email plugin is not modified. Configure or disable it under Settings → MCviseron plugin → After-session action. See [docs/session-end.md](docs/session-end.md).
|
|
59
63
|
|
|
64
|
+
### 6. DSH auth-cookie cleanup
|
|
65
|
+
|
|
66
|
+
- DSH listens on a new loopback port on every launch, but Chromium stores cookies per host, not per port. Old `dsh-auth-<hash(host:port)>` cookies are never overwritten and eventually push the Cookie header past Node's 16 KB limit (HTTP 431).
|
|
67
|
+
- A Host route `POST /api/dsh-mcviseron/auth-cookies/prune` recomputes the current cookie for the request Host, expires every other `dsh-auth-*`, and keeps the current login cookie.
|
|
68
|
+
- A head script calls it on every index load, with one client-entry fallback. It does not limit restarts, does not modify `app.asar`, and survives DSH upgrades.
|
|
69
|
+
- It never reads or logs cookie values; only loopback same-origin POSTs are accepted, and it sends no expiration headers when the Host or current cookie cannot be resolved.
|
|
70
|
+
- If startup already fails with 431, clean the cookie database once; plugins cannot run before authentication. See [docs/auth-cookie.md](docs/auth-cookie.md).
|
|
71
|
+
|
|
60
72
|
## Settings page
|
|
61
73
|
|
|
62
74
|
Settings gains a first-level **MCviseron plugin** section (`settings.section`, id `mcviseron`). Components own a tab there when they have a settings surface:
|
|
63
75
|
|
|
64
76
|
- **Restart**: restart DeepSeek Harness (this component's settings).
|
|
65
77
|
- **After-session action**: enable switch, render grace, AI email reminder, subject/body templates.
|
|
66
|
-
- **Components**: list the
|
|
78
|
+
- **Components**: list the six components and their configuration surfaces.
|
|
67
79
|
|
|
68
80
|
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.
|
|
69
81
|
|
|
@@ -134,7 +146,7 @@ Defaults: appearance off / `08:00–23:00`; auto-review both guards on, 6 s, 400
|
|
|
134
146
|
|
|
135
147
|
| DSH version | Status |
|
|
136
148
|
| --- | --- |
|
|
137
|
-
| `0.2.1-rc.2` | ✅ verified (desktop profile;
|
|
149
|
+
| `0.2.1-rc.2` | ✅ verified (desktop profile; 112 tests + real Cordis contexts) |
|
|
138
150
|
| `0.2.0-rc.x` | ✅ covered by the peer range |
|
|
139
151
|
| `0.1.x` | ❌ unsupported (different settings-namespace model) |
|
|
140
152
|
|
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
|
|
|
@@ -13,6 +13,7 @@ MCviseron 的 **DeepSeek Harness(DSH)总插件**:一个 npm 包、一个 `
|
|
|
13
13
|
| **Todo 计划守卫** | `mcviseron.taskGuard` | 多阶段任务忘记更新 todo 时发出 notice(可选硬拦截) |
|
|
14
14
|
| **重启 DeepSeek Harness** | `mcviseron.restart` | 「设置 → MCviseron 插件」里的重启按钮:关闭并重新启动桌面应用 |
|
|
15
15
|
| **会话后动作** | `mcviseron.sessionEnd` | 输入框左侧「会话后重启」下拉;AI 工具可设置;重启等待任务结束 |
|
|
16
|
+
| **认证 cookie 清理** | 内置 | 每次页面加载过期旧 `dsh-auth-*`,只保留当前,避免重启把请求头推到 16KB |
|
|
16
17
|
|
|
17
18
|
> 0.6.1 起回到**单一** `mcviseron` 条目:DSH `client-modules` 只给精确包名条目组合浏览器半区,子路径条目会让整个客户端插件(外观行、设置分区、重启回退)消失。组件仍在内部作为子插件运行,设置页有 Auto review / Todo 子页。
|
|
18
19
|
|
|
@@ -28,7 +29,8 @@ MCviseron 的 **DeepSeek Harness(DSH)总插件**:一个 npm 包、一个 `
|
|
|
28
29
|
|
|
29
30
|
1. **关机预设守卫**:Auto review 在卸载时会调用 `permissionPresets.set` 把仍处于 Auto 的会话改成 `danger-full-access`。整套宿主退出时这是错误落盘;组件在根 Cordis fiber 不是 `ACTIVE` 时丢弃该写入(运行中移除插件仍然照常迁移)。
|
|
30
31
|
2. **审批理由中文译文**:自动审查拒绝并转人工审批时,`displayReason` 里的英文审查理由原样保留,只在本地化文本末尾追加 `【审查理由 · 中文翻译】` 段落;同时把同一段译文追加到 `reason` 末尾(审计原文保持开头不变),让只读取 `approval/asked` 的邮箱兜底也能收到译文。
|
|
31
|
-
3.
|
|
32
|
+
3. **reviewer 上下文裁剪**:长会话不再把整段历史塞进 Auto review 模型;只包装 reviewer 的 `llm.stream`,保留当前动作、工程约束和全部人类指令,旧工具调用/图片/超长参数压缩,默认历史上限 120k 字符。详见 [docs/auto-review-context.md](docs/auto-review-context.md)。
|
|
33
|
+
4. **转手动被拒理由回传**:当 `approval.request` 返回 `rejected` 且该审批来自 Auto review 时,组件把自动审查理由(含译文)作为 `plugin:auto-review-fix` notice 附到该工具结果的 `additionalContexts`;AI 下一次就能看到「为什么被拒」,而不是只看到 `the user rejected tool ...`。注意:DSH 审批面板目前没有人类理由输入框,回传的是自动审查理由。
|
|
32
34
|
|
|
33
35
|
翻译使用当前会话的 provider/model 再发一次短请求(可选固定 provider/model),按原文缓存(进程内,上限 256),超时 6 秒可配。**任何失败都原样放行审批**:没有 `llm`、没有会话路由、宿主没有 `displayReason`、超时、模型报错——都不会阻塞审批,也不会改写审查文本。
|
|
34
36
|
|
|
@@ -55,19 +57,29 @@ MCviseron 的 **DeepSeek Harness(DSH)总插件**:一个 npm 包、一个 `
|
|
|
55
57
|
### 5. 会话后动作
|
|
56
58
|
|
|
57
59
|
- 对话输入框左侧新增 **「会话后重启」** 下拉:不做操作 / 重启 DSH / 关闭 DSH / 关闭电脑;默认不做操作,每次 DSH 启动都从不做操作开始。
|
|
58
|
-
- 本轮最终回复完整显示后(默认再等 3
|
|
60
|
+
- 本轮最终回复完整显示后(默认再等 3 秒)执行一次;如果用户在这段等待内发了新消息,动作保留并在下一条消息结束后重新排队。
|
|
59
61
|
- AI 通过工具 `set_session_end_action` 设置 **重启** 或 **关闭 DSH**(不能设置关机)。AI 设置后,输入框出现醒目的非弹窗提示;关机只能由用户在下拉里选择。
|
|
60
62
|
- **重启会先做任务探寻**:只要还有运行中的 agent 会话(含等待审批/回答)或后台 job,就持续等待,直到全部结束;关闭 DSH / 关机不等待。**设置页的重启按钮不受此约束**,仍然立即执行。
|
|
61
63
|
- 状态只存在 Host 内存里,一次性执行;执行前先清除,重启后的新进程不会继承,不会因为加载插件或重复 turn/end 无限重启。
|
|
64
|
+
- **多会话全局排异**:多个会话同时设置动作时,第一个进入执行阶段(非等待)的动作设置进程级 `dispatching` 锁,清空其它会话的计时器和状态;两个会话都设 restart 只执行一次。
|
|
65
|
+
- **AI 全局提示**:除当前输入框的强提示外,右上角固定显示「xx 会话已启用 AI 会话自动重启/关闭」;多会话多张卡片,可关闭,动作执行/取消后消失。用户手动设置不显示此全局 AI 提示。
|
|
62
66
|
- **邮件联动**:如果已安装并配置了可发送的 `dsh-email-notify`,AI 开启动作时会复用它的 SMTP 配置发送提醒邮件;不修改邮件插件。可在「设置 → MCviseron 插件 → 会话后动作」关闭或改模板。详见 [docs/session-end.md](docs/session-end.md)。
|
|
63
67
|
|
|
68
|
+
### 6. DSH 认证 cookie 清理
|
|
69
|
+
|
|
70
|
+
- DSH 每次启动换随机端口,但 Chromium 的 cookie 只按 host 保存;旧的 `dsh-auth-<hash(host:port)>` 不会覆盖,30 天后会累积到 16 KB 请求头上限并触发 431。
|
|
71
|
+
- 插件新增 Host 路由 `POST /api/dsh-mcviseron/auth-cookies/prune`:按当前 Host 复算当前 cookie,只过期其他 `dsh-auth-*`,保留当前登录态。
|
|
72
|
+
- 每次 index 页面加载由 head 脚本自动调用,客户端入口再兜底一次;不需要限制重启,也不修改 `app.asar`,DSH 升级不会丢。
|
|
73
|
+
- 不读取/记录 cookie 值;只接受 loopback 同源 POST;Host 非法或当前 cookie 算不出来时不下发过期头。
|
|
74
|
+
- 如果已经累积到启动即 431,需要先一次性清理 cookie 数据库;插件在认证前无法运行。详见 [docs/auth-cookie.md](docs/auth-cookie.md)。
|
|
75
|
+
|
|
64
76
|
## 设置页
|
|
65
77
|
|
|
66
78
|
设置里新增一个一级分区 **「MCviseron 插件」**(`settings.section`,id `mcviseron`),组件按需在这里拥有子页:
|
|
67
79
|
|
|
68
80
|
- **重启**:重启 DeepSeek Harness(本组件的设置面)。
|
|
69
81
|
- **会话后动作**:启用开关、显示等待、AI 邮件提醒、邮件主题/正文模板。
|
|
70
|
-
-
|
|
82
|
+
- **组件**:列出六个组件及其配置位置。
|
|
71
83
|
|
|
72
84
|
外观组件**不在**这里——它的设置行仍留在「通用 → 外观」,位置不变。没有设置面的组件不占用子页;`autoReview` / `taskGuard` 继续通过 profile 配置,组件子页会注明这一点。
|
|
73
85
|
|
|
@@ -228,7 +240,7 @@ DSH 0.2 的官方设置 apiproxy 不向浏览器暴露第三方命名空间,
|
|
|
228
240
|
|
|
229
241
|
| DSH 版本 | 状态 |
|
|
230
242
|
| --- | --- |
|
|
231
|
-
| `0.2.1-rc.2` | ✅ 本版本验证(desktop profile;
|
|
243
|
+
| `0.2.1-rc.2` | ✅ 本版本验证(desktop profile;112 项测试 + 真实 Cordis 上下文) |
|
|
232
244
|
| `0.2.0-rc.x` | ✅ peer 范围覆盖(同一套设置、审批与 hook 接缝) |
|
|
233
245
|
| `0.1.x` | ❌ 不支持:0.1 的插件自行注册设置命名空间,与本插件的条目 id 命名空间模型不同 |
|
|
234
246
|
|
|
@@ -294,7 +306,7 @@ test/
|
|
|
294
306
|
|
|
295
307
|
```bash
|
|
296
308
|
pnpm install
|
|
297
|
-
pnpm check # typecheck +
|
|
309
|
+
pnpm check # typecheck + 112 项测试 + 构建
|
|
298
310
|
```
|
|
299
311
|
|
|
300
312
|
构建产物:`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,61 @@
|
|
|
1
|
+
# DSH 认证 cookie 清理
|
|
2
|
+
|
|
3
|
+
## 问题
|
|
4
|
+
|
|
5
|
+
DSH Desktop 每次启动监听随机 loopback 端口,并下发:
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
dsh-auth-<sha256(host:port)>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Chromium 的 cookie **不按端口隔离**,只按 host 保存;该 cookie 是 30 天持久 cookie 且带 `HttpOnly`。因此每次重启都会在 `127.0.0.1` 下留下一条旧的 `dsh-auth-*`,旧 cookie 不会被覆盖,前端 JS 也无法删除。
|
|
12
|
+
|
|
13
|
+
累积到约 71 条时,`Cookie` 请求头约 16 KB,超过 Node HTTP 服务的默认 `maxHeaderSize`(16384 字节),Host 返回 431,桌面壳报:
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
desktop welcome: Web authentication failed
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 修复方式
|
|
20
|
+
|
|
21
|
+
不限制重启,也不修改 DSH 安装包。插件在 Host 侧提供:
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
POST /api/dsh-mcviseron/auth-cookies/prune
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
流程:
|
|
28
|
+
|
|
29
|
+
1. 按当前请求的 `Host` 和协议复算当前 cookie 名;
|
|
30
|
+
2. 解析 `Cookie` 头里所有合法的 `dsh-auth-*`;
|
|
31
|
+
3. **保留当前 authority 的那一条**;
|
|
32
|
+
4. 对其余旧 cookie 下发过期 `Set-Cookie`:
|
|
33
|
+
```text
|
|
34
|
+
name=; Max-Age=0; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT;
|
|
35
|
+
HttpOnly; SameSite=Strict[; Secure]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
插件还会在所有 index 页面的 `<head>` 注入一次 prune 调用,并在客户端入口做一次兜底调用。每次页面加载后只保留当前 cookie,重启次数不再增加 Cookie 头大小。
|
|
39
|
+
|
|
40
|
+
## 保证与边界
|
|
41
|
+
|
|
42
|
+
- 不读取、不记录任何 cookie 值;
|
|
43
|
+
- 只处理 `dsh-auth-` 前缀且符合生成格式的名字;
|
|
44
|
+
- 当前 cookie 名计算不出来时不下发任何过期头,失败关闭;
|
|
45
|
+
- 路由仅接受 loopback 的同源 POST;
|
|
46
|
+
- 插件方案不依赖 `app.asar`,DSH 升级不会丢失。
|
|
47
|
+
|
|
48
|
+
如果已经累积到启动就返回 431,插件的 Host 还没机会加载,需要**一次性**清理旧 cookie:
|
|
49
|
+
|
|
50
|
+
1. 关闭 DSH;
|
|
51
|
+
2. 备份 `%APPDATA%\@deepseek-ai\dsh-desktop\Network\Cookies`;
|
|
52
|
+
3. 只删除 `host_key = '127.0.0.1'` 且 `name LIKE 'dsh-auth-%'` 的记录;
|
|
53
|
+
4. 重新启动 DSH,之后由插件接管。
|
|
54
|
+
|
|
55
|
+
这是 bootstrap,不是长期补丁。
|
|
56
|
+
|
|
57
|
+
## 验证
|
|
58
|
+
|
|
59
|
+
- `pnpm check` 中的 `test/auth-cookie.test.ts` 覆盖:
|
|
60
|
+
cookie 名算法、HTTP/HTTPS authority、旧 cookie 选择、当前 cookie 保留、删除头属性、loopback/POST 校验、index 注入。
|
|
61
|
+
- 实际重启后可在关闭 DSH 时检查 cookie 库,确认 `dsh-auth-*` 数量保持为 1。
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Auto review 上下文裁剪
|
|
2
|
+
|
|
3
|
+
## 问题
|
|
4
|
+
|
|
5
|
+
DSH 的 `dsh-experimental-auto-review` 在每次工具调用前,把当前 Session 的
|
|
6
|
+
`session.surface.nodes` 全量转成 `FILTERED_HISTORY`,再连同
|
|
7
|
+
`PROJECT_INSTRUCTIONS`、`PENDING_ACTION` 一起送给 reviewer 模型。
|
|
8
|
+
|
|
9
|
+
长会话会超过 reviewer 的上下文窗口:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
CONTEXT_WINDOW_EXCEEDED: max 1048576, requested 1051891
|
|
13
|
+
(795891 in messages, 256000 in completion)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
这不是人工审批弹窗的问题,而是 Auto review 的 LLM 请求在审批之前就失败了。
|
|
17
|
+
|
|
18
|
+
## 修复
|
|
19
|
+
|
|
20
|
+
`auto-review-fix` 包装 `llm.stream`,只识别并改写 Auto review 请求:
|
|
21
|
+
|
|
22
|
+
- system 必须同时包含 `REVIEW_POLICY` 和 `final authorization reviewer`;
|
|
23
|
+
- 消息必须同时包含 `FILTERED_HISTORY` 和 `PENDING_ACTION`。
|
|
24
|
+
|
|
25
|
+
其他对话、翻译和其他插件的 LLM 调用原样放行。
|
|
26
|
+
|
|
27
|
+
### 保留什么
|
|
28
|
+
|
|
29
|
+
- `PENDING_ACTION`:原样保留,评审对象不能被裁剪。
|
|
30
|
+
- `PROJECT_INSTRUCTIONS`:保留,最多 40,000 字符。
|
|
31
|
+
- 所有 `human-instruction` / `direct-parent-instruction`:优先保留。
|
|
32
|
+
- 最近 `reviewKeepRecentEntries` 条历史(默认 16)。
|
|
33
|
+
|
|
34
|
+
### 压缩什么
|
|
35
|
+
|
|
36
|
+
- 旧工具调用/事实:折叠成一条 summary;
|
|
37
|
+
- 单条工具参数:最多 2,000 字符;
|
|
38
|
+
- 单条用户文本:最多 4,000 字符;
|
|
39
|
+
- 图片和附件:移除 base64,只留 `[image omitted from reviewer context]`;
|
|
40
|
+
- `FILTERED_HISTORY` 总预算:默认 120,000 字符。
|
|
41
|
+
|
|
42
|
+
裁剪只作用于 reviewer 的请求副本,不修改会话历史、审计事件或当前工具调用。
|
|
43
|
+
|
|
44
|
+
## 配置
|
|
45
|
+
|
|
46
|
+
设置 → MCviseron 插件 → Auto review 修复:
|
|
47
|
+
|
|
48
|
+
```yaml
|
|
49
|
+
reviewContextGuard: true
|
|
50
|
+
reviewMaxHistoryChars: 120000
|
|
51
|
+
reviewKeepRecentEntries: 16
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 边界
|
|
55
|
+
|
|
56
|
+
- 不自动 allow,不降低风险等级;
|
|
57
|
+
- 历史不足时 reviewer 仍可 fail closed;
|
|
58
|
+
- 请求格式不匹配时完全不改;
|
|
59
|
+
- 裁剪日志写到 `%TEMP%\dsh-mcviseron-auto-review.log`,不记录内容。
|
|
60
|
+
|
|
61
|
+
## 测试
|
|
62
|
+
|
|
63
|
+
`test/review-context.test.ts` 覆盖:非 review 请求不变、PENDING_ACTION 保留、
|
|
64
|
+
人类指令保留、旧事实折叠、图片/工具参数裁剪、畸形 JSON 原样返回、wrapper
|
|
65
|
+
只改写 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 + 112 项 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/release.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## 当前状态(2026-10-23)
|
|
4
4
|
|
|
5
|
-
- 包名 **`dsh-mcviseron-plugin` 当前发布 0.6.
|
|
5
|
+
- 包名 **`dsh-mcviseron-plugin` 当前发布 0.6.6**;v0.6.3 的 host bundle 导入缺陷由 v0.6.4 修复,v0.6.5 修复会话后动作工具注册与 turn/end 监听。
|
|
6
6
|
- npm 账号 `mcviseron` 已恢复正常,可执行首次手动发布。
|
|
7
7
|
- 本机全局 registry 指向 npmmirror,发布时必须显式指定 `--registry=https://registry.npmjs.org/`。
|
|
8
8
|
- 首次发布 **v0.6.1 已手动完成**;从 **v0.6.2** 起由 `.github/workflows/publish.yml` 通过 OIDC Trusted Publishing 发布,tag 推送即发布。
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
|
|
50
50
|
```powershell
|
|
51
51
|
npm view dsh-mcviseron-plugin version dist-tags.latest --registry=https://registry.npmjs.org/
|
|
52
|
-
curl.exe -sI https://registry.npmjs.org/dsh-mcviseron-plugin/-/dsh-mcviseron-plugin-0.6.
|
|
52
|
+
curl.exe -sI https://registry.npmjs.org/dsh-mcviseron-plugin/-/dsh-mcviseron-plugin-0.6.6.tgz | Select-Object -First 1
|
|
53
53
|
curl.exe -X PUT "https://registry.npmmirror.com/-/package/dsh-mcviseron-plugin/syncs"
|
|
54
54
|
```
|
|
55
55
|
|
|
@@ -77,7 +77,7 @@ Trusted Publisher 绑定后,**推送 `v*` tag 即直接发布**,不再需要
|
|
|
77
77
|
|
|
78
78
|
> `workflow_dispatch` 默认只做 `npm pack --dry-run`;要发布当前 `main` 的版本,取消勾选 `dry-run` 再运行。
|
|
79
79
|
>
|
|
80
|
-
> 从 v0.6.3 起 tag 推送直接发布;v0.6.4 覆盖 v0.6.3 的启动导入缺陷;v0.6.5
|
|
80
|
+
> 从 v0.6.3 起 tag 推送直接发布;v0.6.4 覆盖 v0.6.3 的启动导入缺陷;v0.6.5 修复会话后动作;v0.6.6 加入 Auto review 上下文裁剪、认证 cookie 清理和全局 AI 提示。
|
|
81
81
|
|
|
82
82
|
## 回滚与故障
|
|
83
83
|
|
package/docs/session-end.md
CHANGED
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
- 状态只保存在 Host 内存,DSH 每次启动都是关闭;不写 profile、不写 localStorage。
|
|
15
15
|
- 动作是**一次性**的:执行前先清除状态,再调用重启/关闭/关机;不会因为加载插件或重复 `turn/end` 反复重启。
|
|
16
|
-
- 新 turn 开始时,如果上一个 turn
|
|
16
|
+
- 新 turn 开始时,如果上一个 turn 结束后的等待计时器还在,只取消本次计时并保留动作;该 turn 结束后重新排队,避免用户追问时把重启静默吞掉。
|
|
17
|
+
- **全局只执行一次**:多个会话同时设置动作时,第一个真正进入执行阶段(非等待状态)的动作会设置进程级 `dispatching` 锁,取消其它会话的计时器并清空它们的状态;后续动作直接跳过。两个会话都设 restart 只会产生一次重启。
|
|
17
18
|
- 「设置 → MCviseron 插件 → 重启」是另一个组件,仍然**立即**执行,不受任务等待约束。
|
|
18
19
|
|
|
19
20
|
## 任务探寻
|
|
@@ -35,6 +36,7 @@
|
|
|
35
36
|
|
|
36
37
|
- AI 只能设置 `restart` / `close` / `off`;`shutdown` 被拒绝。
|
|
37
38
|
- 工具返回后,输入框通过 1.5 秒轮询拿到 `requestedBy: "ai"`,显示醒目但非弹窗的提示。
|
|
39
|
+
- 同时有一个**全局右上角提示**(不属于当前会话)轮询 `/session-end/global`,显示「xx 会话已启用 AI 会话自动重启/关闭」;多会话会列出多张卡片,可逐张关闭,动作执行/清除后自动消失。
|
|
38
40
|
- 工具设置后到 `turn/end` 才排入执行队列;如果 AI 在最终回复前设置,本轮结束后触发。
|
|
39
41
|
|
|
40
42
|
## 邮件联动(可选)
|
|
@@ -88,6 +90,7 @@ sessionEnd:
|
|
|
88
90
|
| --- | --- | --- |
|
|
89
91
|
| POST | `/api/dsh-mcviseron/session-end/state` | 查询当前 session 状态(1.5 秒轮询) |
|
|
90
92
|
| POST | `/api/dsh-mcviseron/session-end/set` | 用户下拉设置;只允许 loopback |
|
|
93
|
+
| GET/POST | `/api/dsh-mcviseron/session-end/global` | 所有 AI 设置的动作(含 label/waiting),供右上角全局提示轮询 |
|
|
91
94
|
|
|
92
95
|
## 限制
|
|
93
96
|
|