dsh-mcviseron-plugin 0.6.1 → 0.6.3

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 CHANGED
@@ -11,6 +11,28 @@
11
11
  - Restart 组件支持 macOS/Linux(当前仅 Windows 桌面版)。
12
12
  - 把定时巡检任务 prompt 更新为当前单条目架构。
13
13
 
14
+ ## [0.6.3] - 2026-10-22
15
+
16
+ ### Added
17
+
18
+ - **会话后动作**:输入框左侧「会话后重启」下拉(关闭 / 重启 DSH / 关闭 DSH / 关闭电脑),默认关闭且每次 DSH 启动重置;最终回复完整显示后执行一次。
19
+ - **AI 工具** `set_session_end_action`:AI 可在改完插件后设置重启/关闭 DSH;AI 设置时输入框显示醒目非弹窗提示,关机仅用户可选。
20
+ - **重启任务探寻**:会话后重启会等待所有运行中的 agent turn(含等待审批/回答)与后台 job 结束;设置页的重启按钮仍立即执行。
21
+ - **邮件联动**:已安装且配置可发送的 `dsh-email-notify` 时,AI 开启动作会复用其 SMTP 配置发送提醒邮件(不修改邮件插件);可在设置页关闭或改模板。
22
+ - **会话后动作设置子页**:启用、渲染等待、AI 邮件提醒、邮件主题/正文模板。
23
+ - **圆角下拉菜单**:输入框动作选择器由原生 `select` 改为自绘菜单(14px 菜单卡片、10px 选项圆角、悬停/选中态),避免系统下拉的方角外观。
24
+ - 合计 **92 项测试**。
25
+
26
+ ## [0.6.2] - 2026-10-21
27
+
28
+ ### Fixed
29
+
30
+ - **Todo 守卫更新不顺畅**:新增**阶段完成检测**,从 agent/assistant-stream 的正文/思考中识别「All 46 nets routed」「DRC passes clean」「原理图完成」等完成语句,并用中英文阶段关键词(schematic/原理图、routing/布线、DRC/校验 等)匹配当前 in_progress todo;命中时附一条带可直接发送 todo_write JSON 的定向 notice(每步最多一次)。
31
+ - **停滞提醒更可执行**:不再写「请忽略本提醒」;只有一个进行中任务时,notice 直接给出「当前阶段 completed、下一阶段 in_progress」的 payload,模型只需原样发送。
32
+ - **含中文引用的英文审查理由漏翻**:旧逻辑只要审查正文里出现**任意** CJK 字符就判定“已经是中文”并跳过翻译,导致夹带用户原话(「这个提示框似乎卡住了?」)或中文路径(`D:\文档\...`)的英文理由整段保持英文。改为**以中文为主**判断(中文字符数 vs 英文词数),这类英文理由会正常追加 `【审查理由 · 中文翻译】`。
33
+ - **转手动审批被拒理由回传**:auto-review-fix 在 `approval.request` 返回 `rejected` 且属于 Auto review 时,把自动审查理由(含译文)作为 `plugin:auto-review-fix` notice 附到该工具结果的 `additionalContexts`;AI 下一次能看到被拒理由。DSH 审批面板没有人类理由输入,因此回传的是自动审查理由。
34
+ - 合计 **83 项测试**。
35
+
14
36
  ## [0.6.1] - 2026-10-19
15
37
 
16
38
  ### 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 four 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.
5
+ MCviseron's **master plugin for DeepSeek Harness (DSH)**: one npm package and one `mcviseron` profile entry hosting five 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
 
@@ -12,6 +12,7 @@ MCviseron's **master plugin for DeepSeek Harness (DSH)**: one npm package and on
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
14
  | **Restart DeepSeek Harness** | `mcviseron.restart` | Button in Settings → MCviseron plugin that closes and relaunches the desktop application |
15
+ | **After-session action** | `mcviseron.sessionEnd` | “Restart after session” dropdown in the composer; the AI tool can arm it; restart waits for running tasks |
15
16
 
16
17
  > 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.
17
18
 
@@ -25,9 +26,9 @@ MCviseron's **master plugin for DeepSeek Harness (DSH)**: one npm package and on
25
26
  ### 2. Auto-review hardening
26
27
 
27
28
  - 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.
28
- - Appends a `【审查理由 · 中文翻译】` block to the localized `displayReason` only; `reason` and `displayReason.en` stay byte-identical.
29
+ - Appends a `【审查理由 · 中文翻译】` block to the localized `displayReason` and to the audited `reason` (original text stays as the prefix); `displayReason.en` stays byte-identical.
29
30
  - 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.
30
- - A reviewer note that is already Chinese (or contains any CJK text) is never translated again; the approval prompt stays as-is.
31
+ - 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.
31
32
 
32
33
  ### 3. Todo plan guard
33
34
 
@@ -47,12 +48,22 @@ MCviseron's **master plugin for DeepSeek Harness (DSH)**: one npm package and on
47
48
  - Desktop-only: under `dsh web` the status route reports unavailable and the row hides.
48
49
  - **Why not a tray item**: DSH builds its tray menu inside the Electron main process (`DesktopTray` in `lib/main.js`); plugins run in the Host child process and DSH exposes no tray extension point. The Settings row is the supported equivalent.
49
50
 
51
+ ### 5. After-session action
52
+
53
+ - A **“Restart after session”** dropdown left of the composer: Off / Restart DSH / Close DSH / Shut down PC. It starts off 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 cancels it.
55
+ - 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
+ - **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
+ - 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.
58
+ - **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
+
50
60
  ## Settings page
51
61
 
52
62
  Settings gains a first-level **MCviseron plugin** section (`settings.section`, id `mcviseron`). Components own a tab there when they have a settings surface:
53
63
 
54
64
  - **Restart**: restart DeepSeek Harness (this component's settings).
55
- - **Components**: list the four components and their configuration surfaces.
65
+ - **After-session action**: enable switch, render grace, AI email reminder, subject/body templates.
66
+ - **Components**: list the five components and their configuration surfaces.
56
67
 
57
68
  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.
58
69
 
@@ -93,23 +104,37 @@ Add `dsh-mcviseron-plugin` to `dsh.profile.bundles` and remove `dsh-auto-review-
93
104
  restart:
94
105
  enabled: true
95
106
  appPath: ""
107
+ sessionEnd:
108
+ enabled: true
109
+ graceMs: 3000
110
+ notifyEmailOnAi: true
111
+ emailSubject: "[DSH session-end action] {{actionText}}"
112
+ emailBody: |-
113
+ The AI requested {{actionText}} after this session.
114
+
115
+ Session: {{sessionName}}
116
+ Session ID: {{sessionId}}
117
+ Time: {{time}}
118
+ Reason: {{reason}}
96
119
  ```
97
120
 
98
- Defaults: appearance off / `08:00–23:00`; auto-review both guards on, 6 s, 4000 chars; task-guard on, `zh`, stale at 5 / repeat 4, no blocking, step-intent detection and todo translation on (3 s), excludes `todo_write` and `ask_user_question`.
121
+ Defaults: appearance off / `08:00–23:00`; auto-review both guards on, 6 s, 4000 chars; task-guard on, `zh`, stale at 5 / repeat 4, no blocking, step-intent detection and todo translation on (3 s), excludes `todo_write` and `ask_user_question`; session-end on, 3 s grace, AI email reminder on with reusable `dsh-email-notify` SMTP settings.
122
+
123
+ `sessionEnd`: `enabled` (boolean, true), `graceMs` (0–15000, 3000), `notifyEmailOnAi` (boolean, true), `emailSubject` / `emailBody` (templates; see `docs/session-end.md`).
99
124
 
100
125
  ## How it works
101
126
 
102
127
  - `cordis.patch.yml` inserts one `mcviseron` master entry (`name: dsh-mcviseron-plugin`).
103
- - `src/index.ts` mounts the four components with `ctx.plugin`; each keeps its own `inject` and implementation.
128
+ - `src/index.ts` mounts the five components with `ctx.plugin`; each keeps its own `inject` and implementation.
104
129
  - `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.
105
- - The settings bridge accepts appearance top-level fields and nested `autoReviewFix.*` / `taskGuard.*` / `restart.*` paths.
130
+ - The settings bridge accepts appearance top-level fields and nested `autoReviewFix.*` / `taskGuard.*` / `restart.*` / `sessionEnd.*` paths.
106
131
  - The master entry and components unwrap DSH 0.2 volatile config references before use.
107
132
 
108
133
  ## Compatibility
109
134
 
110
135
  | DSH version | Status |
111
136
  | --- | --- |
112
- | `0.2.1-rc.2` | ✅ verified (desktop profile; 75 tests + real Cordis contexts) |
137
+ | `0.2.1-rc.2` | ✅ verified (desktop profile; 92 tests + real Cordis contexts) |
113
138
  | `0.2.0-rc.x` | ✅ covered by the peer range |
114
139
  | `0.1.x` | ❌ unsupported (different settings-namespace model) |
115
140
 
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 条目挂载四个组件。DSH 的 `client-modules` 只给 Loader 行名称精确等于包名的条目组合浏览器半区,因此 master 条目名必须是 `dsh-mcviseron-plugin`;组件作为子插件运行,设置页提供各自子页。原 `dsh-auto-review-restart-fix` 与 `dsh-task-guard` 已并入本插件并逐步废弃。
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
 
@@ -12,6 +12,7 @@ MCviseron 的 **DeepSeek Harness(DSH)总插件**:一个 npm 包、一个 `
12
12
  | **Auto review 修复** | `mcviseron.autoReviewFix` | 关机不再把 Auto 会话写成完全访问;人审提示追加中文译文 |
13
13
  | **Todo 计划守卫** | `mcviseron.taskGuard` | 多阶段任务忘记更新 todo 时发出 notice(可选硬拦截) |
14
14
  | **重启 DeepSeek Harness** | `mcviseron.restart` | 「设置 → MCviseron 插件」里的重启按钮:关闭并重新启动桌面应用 |
15
+ | **会话后动作** | `mcviseron.sessionEnd` | 输入框左侧「会话后重启」下拉;AI 工具可设置;重启等待任务结束 |
15
16
 
16
17
  > 0.6.1 起回到**单一** `mcviseron` 条目:DSH `client-modules` 只给精确包名条目组合浏览器半区,子路径条目会让整个客户端插件(外观行、设置分区、重启回退)消失。组件仍在内部作为子插件运行,设置页有 Auto review / Todo 子页。
17
18
 
@@ -26,19 +27,20 @@ MCviseron 的 **DeepSeek Harness(DSH)总插件**:一个 npm 包、一个 `
26
27
  ### 2. Auto review 修复
27
28
 
28
29
  1. **关机预设守卫**:Auto review 在卸载时会调用 `permissionPresets.set` 把仍处于 Auto 的会话改成 `danger-full-access`。整套宿主退出时这是错误落盘;组件在根 Cordis fiber 不是 `ACTIVE` 时丢弃该写入(运行中移除插件仍然照常迁移)。
29
- 2. **审批理由中文译文**:自动审查拒绝并转人工审批时,`displayReason` 里的英文审查理由原样保留,只在本地化文本末尾追加 `【审查理由 · 中文翻译】` 段落。`reason`(审计字段)与 `displayReason.en` 一字不改。
30
+ 2. **审批理由中文译文**:自动审查拒绝并转人工审批时,`displayReason` 里的英文审查理由原样保留,只在本地化文本末尾追加 `【审查理由 · 中文翻译】` 段落;同时把同一段译文追加到 `reason` 末尾(审计原文保持开头不变),让只读取 `approval/asked` 的邮箱兜底也能收到译文。
31
+ 3. **转手动被拒理由回传**:当 `approval.request` 返回 `rejected` 且该审批来自 Auto review 时,组件把自动审查理由(含译文)作为 `plugin:auto-review-fix` notice 附到该工具结果的 `additionalContexts`;AI 下一次就能看到「为什么被拒」,而不是只看到 `the user rejected tool ...`。注意:DSH 审批面板目前没有人类理由输入框,回传的是自动审查理由。
30
32
 
31
33
  翻译使用当前会话的 provider/model 再发一次短请求(可选固定 provider/model),按原文缓存(进程内,上限 256),超时 6 秒可配。**任何失败都原样放行审批**:没有 `llm`、没有会话路由、宿主没有 `displayReason`、超时、模型报错——都不会阻塞审批,也不会改写审查文本。
32
34
 
33
- 审查理由本身已经是中文(含任意 CJK 字符)时**不会再翻译**,审批卡片保持原样;英文与中文混合、但审查正文已是中文的情况同样跳过。
35
+ 只有审查理由**本身以中文为主**时才跳过翻译;英文理由里夹带的中文引用(例如用户原话「这个提示框似乎卡住了?」)或 Windows 中文路径(`D:\文档\...`)不会再被误判成中文而漏翻。
34
36
 
35
37
  ### 3. Todo 计划守卫
36
38
 
37
39
  - `todo_write` 后如果还有 `pending`、却没有 `in_progress`:附一条**建议性 notice**(默认不把写入变成错误)。
38
- - 连续 N 次成功工具调用没更新 todo:再附一条停滞 notice(默认 5 次后首发,之后每 4 次重复)。
40
+ - 连续 N 次成功工具调用没更新 todo:再附一条停滞 notice(默认 5 次后首发,之后每 4 次重复);如果只有一个进行中任务,notice 里直接给出「当前完成、下一阶段 in_progress」的 `todo_write` payload,不再写「请忽略本提醒」。
39
41
  - 都通过官方 `tools/post-execute` 的 `additionalContexts` 送达,不注册 system prompt 段落,不注入用户提示词。
40
42
  - 可选严格模式:`rejectMissingActive: true` 拒绝缺少 active 的写入;`blockAfterCalls: N` 在停滞过久时硬拦截下一次工具调用。
41
- - **步骤意图检测**(`detectStepIntent`):监听官方 `agent/assistant-stream` 的 `text-delta` / `reasoning-delta`,识别「Now I will …」「接下来我会 …」「下一步 …」等句式,并与 `pending` todo 做 token 匹配。命中时附一条**定向 notice**(每条消息最多一次),里面带可直接发送的 `todo_write` JSON;不匹配、没有流、解析失败都静默跳过,**绝不阻塞任务**。
43
+ - **步骤意图 + 阶段完成检测**(`detectStepIntent`):监听官方 `agent/assistant-stream`,识别「Now I will …」「接下来…」「Now building the PCB」等步骤意图,以及「All 46 nets routed」「DRC passes clean」「原理图完成」等阶段完成语句。意图按中英文阶段关键词(schematic/原理图、routing/布线、DRC/校验 等)匹配 `pending` todo;完成语句匹配当前 `in_progress` todo。命中时附一条**定向 notice**(每条消息最多一次),带可直接发送的 `todo_write` JSON;不匹配、没有流、解析失败都静默跳过,**绝不阻塞任务**。
42
44
  - **中文 todo 展示**(`translateTodoContent`):notice 里的英文 todo 标题会经 `llm` 批量翻译成「中文(English)」显示,按标题缓存、超时 3 秒可配;翻译失败就显示原文。notice 里还会提示「todo 内容可以直接用中文书写」。**只影响 notice 展示,不改写模型写入的 todo 列表**。
43
45
  - notice 的 source kind 按会话格式自动选择:v4 用 `plugin:task-guard`,v3 用 `plugin` + `plugin: 'task-guard'`。
44
46
 
@@ -50,12 +52,22 @@ MCviseron 的 **DeepSeek Harness(DSH)总插件**:一个 npm 包、一个 `
50
52
  - 只在桌面版可用;`dsh web` 下状态接口返回不可用,设置行自动隐藏。
51
53
  - **为什么不做成托盘菜单项**:DSH 的托盘菜单由 Electron 主进程的 `lib/main.js` 直接构建(`DesktopTray`),插件运行在独立的 Host 子进程里,官方没有提供托盘扩展点;因此本组件只能在设置页提供等价入口。
52
54
 
55
+ ### 5. 会话后动作
56
+
57
+ - 对话输入框左侧新增 **「会话后重启」** 下拉:关闭 / 重启 DSH / 关闭 DSH / 关闭电脑;默认关闭,每次 DSH 启动都从关闭开始。
58
+ - 本轮最终回复完整显示后(默认再等 3 秒)执行一次;如果用户在这段等待内发了新消息,动作取消。
59
+ - AI 通过工具 `set_session_end_action` 设置 **重启** 或 **关闭 DSH**(不能设置关机)。AI 设置后,输入框出现醒目的非弹窗提示;关机只能由用户在下拉里选择。
60
+ - **重启会先做任务探寻**:只要还有运行中的 agent 会话(含等待审批/回答)或后台 job,就持续等待,直到全部结束;关闭 DSH / 关机不等待。**设置页的重启按钮不受此约束**,仍然立即执行。
61
+ - 状态只存在 Host 内存里,一次性执行;执行前先清除,重启后的新进程不会继承,不会因为加载插件或重复 turn/end 无限重启。
62
+ - **邮件联动**:如果已安装并配置了可发送的 `dsh-email-notify`,AI 开启动作时会复用它的 SMTP 配置发送提醒邮件;不修改邮件插件。可在「设置 → MCviseron 插件 → 会话后动作」关闭或改模板。详见 [docs/session-end.md](docs/session-end.md)。
63
+
53
64
  ## 设置页
54
65
 
55
66
  设置里新增一个一级分区 **「MCviseron 插件」**(`settings.section`,id `mcviseron`),组件按需在这里拥有子页:
56
67
 
57
68
  - **重启**:重启 DeepSeek Harness(本组件的设置面)。
58
- - **组件**:列出四个组件及其配置位置。
69
+ - **会话后动作**:启用开关、显示等待、AI 邮件提醒、邮件主题/正文模板。
70
+ - **组件**:列出五个组件及其配置位置。
59
71
 
60
72
  外观组件**不在**这里——它的设置行仍留在「通用 → 外观」,位置不变。没有设置面的组件不占用子页;`autoReview` / `taskGuard` 继续通过 profile 配置,组件子页会注明这一点。
61
73
 
@@ -109,6 +121,18 @@ pnpm add dsh-mcviseron-plugin
109
121
  restart:
110
122
  enabled: true
111
123
  appPath: ""
124
+ sessionEnd:
125
+ enabled: true
126
+ graceMs: 3000
127
+ notifyEmailOnAi: true
128
+ emailSubject: "[DSH 会话后动作] {{actionText}}"
129
+ emailBody: |-
130
+ AI 已请求在本轮会话结束后{{actionText}}。
131
+
132
+ 会话:{{sessionName}}
133
+ 会话 ID:{{sessionId}}
134
+ 时间:{{time}}
135
+ 理由:{{reason}}
112
136
  ```
113
137
 
114
138
  ### 外观(Config 顶层字段)
@@ -155,6 +179,16 @@ pnpm add dsh-mcviseron-plugin
155
179
  | `enabled` | boolean | `true` | 是否注册设置页重启按钮与接口 |
156
180
  | `appPath` | string | `''` | 显式指定应用 exe;空 = 从 Host 进程推导 |
157
181
 
182
+ ### `sessionEnd`
183
+
184
+ | 字段 | 类型 | 默认值 | 说明 |
185
+ | --- | --- | --- | --- |
186
+ | `enabled` | boolean | `true` | 是否显示输入框下拉并允许 AI 设置 |
187
+ | `graceMs` | number | `3000` | turn/end 后等待最终文字渲染的时间,0–15000 |
188
+ | `notifyEmailOnAi` | boolean | `true` | AI 开启动作时发送邮件;需要已配置的 `dsh-email-notify` |
189
+ | `emailSubject` | string | `[DSH 会话后动作] {{actionText}}` | 邮件主题模板 |
190
+ | `emailBody` | string | 见上方 YAML | 邮件正文模板,支持 `{{actionText}}` / `{{sessionName}}` / `{{sessionId}}` / `{{time}}` / `{{reason}}` |
191
+
158
192
  ## 工作原理
159
193
 
160
194
  ### 单一 master 条目
@@ -167,15 +201,15 @@ pnpm add dsh-mcviseron-plugin
167
201
  name: dsh-mcviseron-plugin
168
202
  ```
169
203
 
170
- 包根导出 `.` → `lib/index.js`。`src/index.ts` 的 `apply()` 用 `ctx.plugin` 依次挂载四个子组件,每个子组件保留自己的 `inject`、`Config` 与实现;设置页由 `src/client/` 注册。
204
+ 包根导出 `.` → `lib/index.js`。`src/index.ts` 的 `apply()` 用 `ctx.plugin` 依次挂载五个子组件,每个子组件保留自己的 `inject`、`Config` 与实现;设置页由 `src/client/` 注册。
171
205
 
172
206
  ### 组件装配
173
207
 
174
- - `src/index.ts`:master 条目,挂载 appearance / auto-review-fix / task-guard / restart。
208
+ - `src/index.ts`:master 条目,挂载 appearance / auto-review-fix / task-guard / restart / session-end。
175
209
  - `src/appearance/index.ts`:只有 Host 设置桥(`ctx.settings.configure({ auto: false })` + 两条 loopback 路由);浏览器半边在 `src/client/`,读取 `mcviseron` 命名空间并驱动 `ctx.theme.setTheme`。
176
210
  - `src/auto-review-fix/index.ts`:`installAutoReview`,通过 `ctx.inject(['permissionPresets' | 'approval'])` 特性探测并包装服务。
177
211
  - `src/task-guard/index.ts`:`installTaskGuard`,注册 `tools/pre-execute`、`tools/post-execute`、`agent/pre-step`、`session/event`。
178
- - master 与四个子组件都会先 `toPlain()` 展开 DSH 0.2 的 volatile 配置引用,再交给实现。
212
+ - master 与五个子组件都会先 `toPlain()` 展开 DSH 0.2 的 volatile 配置引用,再交给实现。
179
213
 
180
214
  ### 设置桥
181
215
 
@@ -184,7 +218,7 @@ DSH 0.2 的官方设置 apiproxy 不向浏览器暴露第三方命名空间,
184
218
  - `POST /api/dsh-mcviseron/settings/describe`
185
219
  - `POST /api/dsh-mcviseron/settings/mutate`
186
220
 
187
- 只接受命名空间 `mcviseron`;顶层接受 `enabled` / `lightStart` / `lightEnd`,并允许 `autoReviewFix.*` / `taskGuard.*` / `restart.*` 嵌套路径(类型与范围会校验)。所有请求执行 loopback 地址 + Host 头 + 同源校验。
221
+ 只接受命名空间 `mcviseron`;顶层接受 `enabled` / `lightStart` / `lightEnd`,并允许 `autoReviewFix.*` / `taskGuard.*` / `restart.*` / `sessionEnd.*` 嵌套路径(类型与范围会校验)。所有请求执行 loopback 地址 + Host 头 + 同源校验。
188
222
 
189
223
  ### 时间语义(appearance)
190
224
 
@@ -194,7 +228,7 @@ DSH 0.2 的官方设置 apiproxy 不向浏览器暴露第三方命名空间,
194
228
 
195
229
  | DSH 版本 | 状态 |
196
230
  | --- | --- |
197
- | `0.2.1-rc.2` | ✅ 本版本验证(desktop profile;75 项测试 + 真实 Cordis 上下文) |
231
+ | `0.2.1-rc.2` | ✅ 本版本验证(desktop profile;92 项测试 + 真实 Cordis 上下文) |
198
232
  | `0.2.0-rc.x` | ✅ peer 范围覆盖(同一套设置、审批与 hook 接缝) |
199
233
  | `0.1.x` | ❌ 不支持:0.1 的插件自行注册设置命名空间,与本插件的条目 id 命名空间模型不同 |
200
234
 
@@ -224,7 +258,7 @@ src/
224
258
  volatile.ts 展开 DSH volatile 配置引用
225
259
  loopback.ts loopback 信任栅栏
226
260
  routes.ts settings describe/mutate 桥(含嵌套组件路径)
227
- index.ts master 条目:Config + 挂载四个子组件
261
+ index.ts master 条目:Config + 挂载五个子组件
228
262
  appearance/index.ts 外观子组件:设置桥
229
263
  auto-review-fix/index.ts Auto review 子组件:Config + 装配
230
264
  task-guard/index.ts Todo 守卫子组件:Config + 装配
@@ -260,7 +294,7 @@ test/
260
294
 
261
295
  ```bash
262
296
  pnpm install
263
- pnpm check # typecheck + 75 项测试 + 构建
297
+ pnpm check # typecheck + 92 项测试 + 构建
264
298
  ```
265
299
 
266
300
  构建产物:`lib/index.js`(master ESM)、`lib/appearance.js`、`lib/auto-review-fix.js`、`lib/task-guard.js`、`lib/restart.js` 与 `lib/client.js`(浏览器模块)。`lib/` 不入库。
@@ -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 + 75 项 node 测试 + esbuild 构建),补齐或修正测试;必要时更新 test/plugin.test.ts 的装配断言。
41
+ c. 执行 pnpm check(tsc --noEmit + 92 项 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
@@ -1,11 +1,11 @@
1
1
  # 发布 dsh-mcviseron-plugin 到 npm
2
2
 
3
- ## 当前状态(2026-10-19)
3
+ ## 当前状态(2026-10-22)
4
4
 
5
- - 包名 **`dsh-mcviseron-plugin` 在 npmjs 可用**(`npm view` 返回 404,未占用)。
5
+ - 包名 **`dsh-mcviseron-plugin` 已发布 0.6.2**,npm 上 `latest` 为 0.6.2;**v0.6.3 由 Trusted Publishing 自动发布**。
6
6
  - npm 账号 `mcviseron` 已恢复正常,可执行首次手动发布。
7
7
  - 本机全局 registry 指向 npmmirror,发布时必须显式指定 `--registry=https://registry.npmjs.org/`。
8
- - 首次发布 **v0.6.1 需要手动完成**;之后由 `.github/workflows/publish.yml` 通过 OIDC Trusted Publishing 发布。
8
+ - 首次发布 **v0.6.1 已手动完成**;从 **v0.6.2** 起由 `.github/workflows/publish.yml` 通过 OIDC Trusted Publishing 发布,tag 推送即发布。
9
9
 
10
10
  ## 首次发布(账号解冻后)
11
11
 
@@ -48,7 +48,7 @@
48
48
 
49
49
  ```powershell
50
50
  npm view dsh-mcviseron-plugin version dist-tags.latest --registry=https://registry.npmjs.org/
51
- curl.exe -sI https://registry.npmjs.org/dsh-mcviseron-plugin/-/dsh-mcviseron-plugin-0.6.1.tgz | Select-Object -First 1
51
+ curl.exe -sI https://registry.npmjs.org/dsh-mcviseron-plugin/-/dsh-mcviseron-plugin-0.6.3.tgz | Select-Object -First 1
52
52
  curl.exe -X PUT "https://registry.npmmirror.com/-/package/dsh-mcviseron-plugin/syncs"
53
53
  ```
54
54
 
@@ -65,7 +65,7 @@ npmjs.com → `dsh-mcviseron-plugin` → **Settings → Trusted Publisher → Gi
65
65
  | Allow npm publish | 勾选 |
66
66
  | Allow npm dist-tag | 勾选 |
67
67
 
68
- 然后在 GitHub 仓库 **Settings → Actions → Variables** 设置 `NPM_PUBLISH_ENABLED=true`。
68
+ Trusted Publisher 绑定后,**推送 `v*` tag 即直接发布**,不再需要 repository variable。
69
69
 
70
70
  ## 后续发版
71
71
 
@@ -74,7 +74,9 @@ npmjs.com → `dsh-mcviseron-plugin` → **Settings → Trusted Publisher → Gi
74
74
  3. `git tag vX.Y.Z && git push origin main --tags`。
75
75
  4. `publish.yml` 会校验 tag 与版本一致、跑测试与构建、检查 tarball 内容,然后通过 OIDC 发布并附带 provenance。
76
76
 
77
- > 未设置 `NPM_PUBLISH_ENABLED=true` 时,tag 构建仍会跑,但发布会跳过并输出 notice。
77
+ > `workflow_dispatch` 默认只做 `npm pack --dry-run`;要发布当前 `main` 的版本,取消勾选 `dry-run` 再运行。
78
+ >
79
+ > v0.6.2 的 tag 运行发生在门禁移除之前,重跑仍会使用旧 workflow;从 v0.6.3 起 tag 推送直接发布。
78
80
 
79
81
  ## 回滚与故障
80
82
 
@@ -0,0 +1,97 @@
1
+ # 会话后动作(sessionEnd)
2
+
3
+ 输入框左侧的「会话后重启」下拉,以及 AI 工具 `set_session_end_action`。
4
+
5
+ ## 行为
6
+
7
+ | 动作 | 谁可以设置 | 执行时机 | 是否等待任务 |
8
+ | --- | --- | --- | --- |
9
+ | 关闭 | 用户 / AI | — | — |
10
+ | 重启 DSH | 用户 / AI | 本轮最终回复显示完 + `graceMs` | **是**:等待所有运行中的 agent turn 和后台 job |
11
+ | 关闭 DSH | 用户 / AI | 同上 | 否 |
12
+ | 关闭电脑 | **仅用户** | 同上 | 否 |
13
+
14
+ - 状态只保存在 Host 内存,DSH 每次启动都是关闭;不写 profile、不写 localStorage。
15
+ - 动作是**一次性**的:执行前先清除状态,再调用重启/关闭/关机;不会因为加载插件或重复 `turn/end` 反复重启。
16
+ - 新 turn 开始时,如果上一个 turn 结束后的等待计时器还在,会取消并清除动作;用户在等待期间发消息就不会被意外重启。
17
+ - 「设置 → MCviseron 插件 → 重启」是另一个组件,仍然**立即**执行,不受任务等待约束。
18
+
19
+ ## 任务探寻
20
+
21
+ 重启前读取:
22
+
23
+ - `ctx.agents.list()` 中 `status === 'running'` 的 agent(包含等待审批/回答的 turn、子 agent);
24
+ - `ctx.jobs.list()` 中 `status === 'running' | 'stopping'` 的后台 job(同时按全局和 live owner 收集,去重)。
25
+
26
+ 任意一项存在就每 2 秒复查一次,直到全部结束;等待期间输入框的提示会显示「等待其它任务结束」。关闭 DSH / 关机不等待。
27
+
28
+ ## AI 工具
29
+
30
+ 工具名:`set_session_end_action`
31
+
32
+ ```json
33
+ { "action": "restart" | "close" | "off", "reason": "optional" }
34
+ ```
35
+
36
+ - AI 只能设置 `restart` / `close` / `off`;`shutdown` 被拒绝。
37
+ - 工具返回后,输入框通过 1.5 秒轮询拿到 `requestedBy: "ai"`,显示醒目但非弹窗的提示。
38
+ - 工具设置后到 `turn/end` 才排入执行队列;如果 AI 在最终回复前设置,本轮结束后触发。
39
+
40
+ ## 邮件联动(可选)
41
+
42
+ 当同时满足以下条件时,AI 设置 `restart`/`close` 会发送一封提醒邮件:
43
+
44
+ 1. 已安装 `dsh-email-notify`,且其设置命名空间 `email-notify` 可读;
45
+ 2. `enabled` 不为 false,且 `smtpHost` / `smtpUser` / `smtpPassword` / `mailTo` 均可发送(`mailFrom` 为空时回退到 `smtpUser`);
46
+ 3. 本插件的 `sessionEnd.notifyEmailOnAi` 为 `true`(默认)。
47
+
48
+ 实现方式:
49
+
50
+ - 通过 Host 的 `settings.describe({ redactSecrets: false })` 读取邮件插件已经配置的 SMTP 字段(仅 Host 内部使用,不经过浏览器,不打印密码);
51
+ - 用内置的 `nodemailer` 发送自定义主题/正文,**不修改 `dsh-email-notify`**;
52
+ - 邮件发送是异步 best-effort:失败只写 `%TEMP%\dsh-mcviseron-session-end.log`,不阻塞工具结果和重启动作;
53
+ - 同一 session + action 60 秒内只发一次,避免 AI 重复调用造成轰炸。
54
+
55
+ 模板字段:
56
+
57
+ | 占位符 | 值 |
58
+ | --- | --- |
59
+ | `{{action}}` | `restart` / `close` |
60
+ | `{{actionText}}` | 重启 DeepSeek Harness / 关闭 DeepSeek Harness |
61
+ | `{{sessionName}}` | 会话标题(缺失时用 sessionId) |
62
+ | `{{sessionId}}` | 会话 ID |
63
+ | `{{time}}` | 本地时间 |
64
+ | `{{reason}}` | 工具参数 `reason`,空时显示「(未提供)」 |
65
+
66
+ ## 配置
67
+
68
+ ```yaml
69
+ sessionEnd:
70
+ enabled: true # 输入框下拉 + AI 工具
71
+ graceMs: 3000 # 最终回复渲染等待,0–15000
72
+ notifyEmailOnAi: true # AI 开启时发邮件
73
+ emailSubject: "[DSH 会话后动作] {{actionText}}"
74
+ emailBody: |-
75
+ AI 已请求在本轮会话结束后{{actionText}}。
76
+
77
+ 会话:{{sessionName}}
78
+ 会话 ID:{{sessionId}}
79
+ 时间:{{time}}
80
+ 理由:{{reason}}
81
+ ```
82
+
83
+ 这些字段也在「设置 → MCviseron 插件 → 会话后动作」子页中提供;配置修改后如果运行中的组件还没拿到新值,重启 DSH 生效。
84
+
85
+ ## 接口
86
+
87
+ | 方法 | 路径 | 用途 |
88
+ | --- | --- | --- |
89
+ | POST | `/api/dsh-mcviseron/session-end/state` | 查询当前 session 状态(1.5 秒轮询) |
90
+ | POST | `/api/dsh-mcviseron/session-end/set` | 用户下拉设置;只允许 loopback |
91
+
92
+ ## 限制
93
+
94
+ - 关闭 DSH / 关机按设计不等待任务(只有重启等待)。
95
+ - 欢迎页/浏览器刷新不会重置 Host 内存状态;新的 DSH 进程一定从关闭开始。
96
+ - 邮件联动读取的是抓取时的 SMTP 配置;邮件插件设置改变后,下一次 AI 设置动作会重新读取。
97
+ - 邮件发送失败不会阻止重启/关闭,也不会在 UI 中弹窗;需要诊断时查看上面的临时日志。
package/lib/appearance.js CHANGED
@@ -113,7 +113,12 @@ var FIELD_RULES = {
113
113
  "taskGuard.include": { type: "strings" },
114
114
  "taskGuard.exclude": { type: "strings" },
115
115
  "restart.enabled": { type: "boolean" },
116
- "restart.appPath": { type: "string" }
116
+ "restart.appPath": { type: "string" },
117
+ "sessionEnd.enabled": { type: "boolean" },
118
+ "sessionEnd.graceMs": { type: "number", min: 0, max: 15e3 },
119
+ "sessionEnd.notifyEmailOnAi": { type: "boolean" },
120
+ "sessionEnd.emailSubject": { type: "string" },
121
+ "sessionEnd.emailBody": { type: "string" }
117
122
  };
118
123
  function ruleFor(path) {
119
124
  if (!Array.isArray(path) || path.length === 0 || path.length > 2) return void 0;
@@ -182,7 +187,8 @@ function toPluginView(descriptor) {
182
187
  ...normalizeScheduleConfig(plain),
183
188
  autoReviewFix: isRecord(record.autoReviewFix) ? record.autoReviewFix : {},
184
189
  taskGuard: isRecord(record.taskGuard) ? record.taskGuard : {},
185
- restart: isRecord(record.restart) ? record.restart : {}
190
+ restart: isRecord(record.restart) ? record.restart : {},
191
+ sessionEnd: isRecord(record.sessionEnd) ? record.sessionEnd : {}
186
192
  },
187
193
  revision: descriptor.revision
188
194
  };
@@ -1,6 +1,9 @@
1
1
  // src/auto-review-fix/index.ts
2
2
  import z from "@deepseek-ai/schemastery";
3
3
 
4
+ // src/components/auto-review-fix/index.ts
5
+ import { randomUUID } from "node:crypto";
6
+
4
7
  // src/components/auto-review-fix/translate.ts
5
8
  var TRANSLATION_LABEL = "\u3010\u5BA1\u67E5\u7406\u7531 \xB7 \u4E2D\u6587\u7FFB\u8BD1\u3011";
6
9
  var SYSTEM_PROMPT = [
@@ -31,7 +34,7 @@ function isAutoReviewText(text) {
31
34
  return /auto[\s\-_]*review/i.test(text);
32
35
  }
33
36
  function reviewerExcerpt(text) {
34
- const match = /^\s*auto[\s\-_]*review\s+denied\s+this\s+call\s*[::.]?\s*/i.exec(text);
37
+ const match = /^\s*auto[\s\-_]*review\s+(?:denied\s+this\s+call|拒绝了此调用)\s*[::.]?\s*/i.exec(text);
35
38
  if (match === null) return text.trim();
36
39
  const rest = text.slice(match[0].length).trim();
37
40
  return rest.length === 0 ? text.trim() : rest;
@@ -46,8 +49,11 @@ ${translation}`;
46
49
  function hasTranslation(value) {
47
50
  return value.includes(TRANSLATION_LABEL);
48
51
  }
49
- function containsCjk(text) {
50
- return /[\u3400-\u9fff\uf900-\ufaff]/.test(text);
52
+ function isPredominantlyChinese(text) {
53
+ const han = (text.match(/[\u3400-\u9fff\uf900-\ufaff]/g) ?? []).length;
54
+ if (han === 0) return false;
55
+ const englishWords = (text.match(/[A-Za-z][A-Za-z0-9_.-]*/g) ?? []).length;
56
+ return englishWords <= Math.max(2, Math.ceil(han / 2));
51
57
  }
52
58
  function cleanTranslation(raw) {
53
59
  let text = raw.trim();
@@ -242,7 +248,7 @@ async function decorateApprovalRequest(scope, settings, request, translate = tra
242
248
  if (typeof localized !== "string" || hasTranslation(localized)) return request;
243
249
  const excerpt = reviewerExcerpt(english);
244
250
  if (excerpt.length === 0 || excerpt.length > settings.maxChars) return request;
245
- if (containsCjk(excerpt)) return request;
251
+ if (isPredominantlyChinese(excerpt)) return request;
246
252
  if (translationRoute(settings, request) === void 0) return request;
247
253
  const llm = serviceOf(scope, "llm");
248
254
  const translated = await translate(llm, settings, request, excerpt);
@@ -258,7 +264,107 @@ async function decorateApprovalRequest(scope, settings, request, translate = tra
258
264
  displayReason: { ...record, [key]: withTranslation(localized, cleaned) }
259
265
  };
260
266
  }
261
- function installApprovalTranslation(ctx, settings) {
267
+ function sessionIdOf(agent) {
268
+ const session = agent?.session;
269
+ return typeof session?.id === "string" ? session.id : "";
270
+ }
271
+ function sessionVersion(agent) {
272
+ const version = agent?.session?.header?.version;
273
+ return typeof version === "number" ? version : void 0;
274
+ }
275
+ function rejectionKey(agent, callId) {
276
+ if (typeof callId !== "string" || callId === "") return "";
277
+ const sessionId = sessionIdOf(agent);
278
+ return sessionId === "" ? "" : sessionId + ":" + callId;
279
+ }
280
+ function approvalReasonText(request) {
281
+ const record = request;
282
+ const display = record.displayReason;
283
+ if (display !== null && typeof display === "object" && !Array.isArray(display)) {
284
+ const key = chineseKey(display);
285
+ if (key !== void 0) {
286
+ const value = display[key];
287
+ if (typeof value === "string" && value !== "") return value;
288
+ }
289
+ const english = englishText(display);
290
+ if (english !== void 0 && english !== "") return english;
291
+ }
292
+ return typeof record.reason === "string" ? record.reason : "";
293
+ }
294
+ function isAutoReviewApproval(request) {
295
+ const record = request;
296
+ if (typeof record.reason === "string" && isAutoReviewText(record.reason)) return true;
297
+ const display = record.displayReason;
298
+ if (display !== null && typeof display === "object" && !Array.isArray(display)) {
299
+ const english = englishText(display);
300
+ if (english !== void 0 && isAutoReviewText(english)) return true;
301
+ }
302
+ return false;
303
+ }
304
+ function rejectionSource(agent, summary) {
305
+ return sessionVersion(agent) === 3 ? { kind: "plugin", plugin: "auto-review-fix", form: "notice", summary } : { kind: "plugin:auto-review-fix", form: "notice", summary };
306
+ }
307
+ function buildRejectionNotice(agent, request) {
308
+ const reason = approvalReasonText(request);
309
+ if (reason === "") return void 0;
310
+ const toolName = typeof request.toolName === "string" && request.toolName !== "" ? request.toolName : "\u672A\u77E5\u5DE5\u5177";
311
+ const text = [
312
+ '\u3010\u5BA1\u6279\u88AB\u62D2\u3011\u5DE5\u5177 "' + toolName + '" \u7684\u4EBA\u5DE5\u5BA1\u6279\u88AB\u62D2\u7EDD\u3002',
313
+ "\u81EA\u52A8\u5BA1\u67E5\u7406\u7531\uFF1A",
314
+ reason,
315
+ "",
316
+ "\u8BF7\u6839\u636E\u8BE5\u7406\u7531\u8C03\u6574\u65B9\u6848\uFF0C\u4E0D\u8981\u91CD\u590D\u540C\u4E00\u64CD\u4F5C\u3002"
317
+ ].join("\n");
318
+ return {
319
+ id: randomUUID(),
320
+ role: "user",
321
+ content: [{ type: "text", text }],
322
+ source: rejectionSource(agent, "\u5BA1\u6279\u88AB\u62D2 \xB7 " + toolName)
323
+ };
324
+ }
325
+ function createRejectionRelay() {
326
+ const notes = /* @__PURE__ */ new Map();
327
+ const ttl = 12e4;
328
+ return {
329
+ remember(key, notice) {
330
+ const now = Date.now();
331
+ for (const [oldKey, entry] of notes) if (now - entry.at > ttl) notes.delete(oldKey);
332
+ if (notes.size >= 50) {
333
+ const oldest = notes.keys().next().value;
334
+ if (oldest !== void 0) notes.delete(oldest);
335
+ }
336
+ notes.set(key, { notice, at: now });
337
+ },
338
+ take(key) {
339
+ const entry = notes.get(key);
340
+ if (entry === void 0) return void 0;
341
+ notes.delete(key);
342
+ return entry.notice;
343
+ }
344
+ };
345
+ }
346
+ var relayedContexts = /* @__PURE__ */ new WeakSet();
347
+ function installRejectionRelay(ctx, relay) {
348
+ const target = ctx;
349
+ if (typeof target.on !== "function" || relayedContexts.has(ctx)) return;
350
+ relayedContexts.add(ctx);
351
+ target.on.call(ctx, "tools/post-execute", async (exec, result, next) => {
352
+ const downstream = await next() ?? { kind: "accept" };
353
+ if (result?.isError !== true) return downstream;
354
+ const key = rejectionKey(exec?.agent, exec?.callId);
355
+ if (key === "") return downstream;
356
+ const notice = relay.take(key);
357
+ if (notice === void 0) return downstream;
358
+ return {
359
+ ...downstream,
360
+ additionalContexts: [
361
+ ...Array.isArray(downstream.additionalContexts) ? downstream.additionalContexts : [],
362
+ notice
363
+ ]
364
+ };
365
+ });
366
+ }
367
+ function installApprovalTranslation(ctx, settings, relay) {
262
368
  whenService(ctx, "approval", (scope) => {
263
369
  const approval = serviceOf(scope, "approval");
264
370
  if (approval === null || typeof approval !== "object") return;
@@ -273,7 +379,14 @@ function installApprovalTranslation(ctx, settings) {
273
379
  } catch {
274
380
  decorated = request;
275
381
  }
276
- return call.call(this, decorated);
382
+ const outcome = await call.call(this, decorated);
383
+ if (outcome === "rejected" && isAutoReviewApproval(decorated)) {
384
+ const request2 = decorated;
385
+ const key = rejectionKey(request2.agent, request2.callId);
386
+ const notice = buildRejectionNotice(request2.agent, decorated);
387
+ if (key !== "" && notice !== void 0) relay.remember(key, notice);
388
+ }
389
+ return outcome;
277
390
  };
278
391
  try {
279
392
  approval.request = wrapper;
@@ -289,7 +402,11 @@ function installApprovalTranslation(ctx, settings) {
289
402
  function installAutoReview(ctx, config) {
290
403
  const settings = normalizeConfig(config);
291
404
  if (settings.keepPresetGuard) installPresetGuard(ctx);
292
- if (settings.enabled) installApprovalTranslation(ctx, settings);
405
+ if (settings.enabled) {
406
+ const relay = createRejectionRelay();
407
+ installRejectionRelay(ctx, relay);
408
+ installApprovalTranslation(ctx, settings, relay);
409
+ }
293
410
  }
294
411
 
295
412
  // src/volatile.ts