dsh-mcviseron-plugin 0.8.4 → 0.8.5

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
@@ -1,3 +1,13 @@
1
+ ## [0.8.5] - 2026-12-06
2
+
3
+ ### Reverted
4
+
5
+ - **回退 0.8.4 的 Windows 重启 helper**:恢复原来的 Task Scheduler 直接启动应用逻辑;移除等待旧 main/host PID 的 PowerShell helper。设置页和侧边栏仍共用原重启路由。
6
+
7
+ ### Tests
8
+
9
+ - 合计 **130 项测试**;typecheck、build 全绿。
10
+
1
11
  ## [0.8.4] - 2026-12-06
2
12
 
3
13
  ### Fixed
package/README.en.md CHANGED
@@ -155,12 +155,12 @@ Defaults: appearance off / `08:00–23:00`; auto-review both guards on, 6 s, 400
155
155
 
156
156
  | DSH version | Status |
157
157
  | --- | --- |
158
- | `0.2.2-rc.5` | ✅ pre-adapted (0.2.2-rc.5 types/deps + 131 tests; current desktop still rc.3) |
159
- | `0.2.2-rc.3` | ✅ current desktop (rc.3 types/deps + 131 tests; real runtime verified) |
160
- | `0.2.2-rc.1` | ✅ compatible (0.2.2-rc.1 types/deps + 131 tests) |
161
- | `0.2.1-rc.5` | ✅ compatible (rc.5 types/deps + 131 tests) |
162
- | `0.2.1-rc.3` | ✅ compatible (rc.3 types/deps + 131 tests) |
163
- | `0.2.1-rc.2` | ✅ current desktop runtime (131 tests + real Cordis contexts) |
158
+ | `0.2.2-rc.5` | ✅ pre-adapted (0.2.2-rc.5 types/deps + 130 tests; current desktop still rc.3) |
159
+ | `0.2.2-rc.3` | ✅ current desktop (rc.3 types/deps + 130 tests; real runtime verified) |
160
+ | `0.2.2-rc.1` | ✅ compatible (0.2.2-rc.1 types/deps + 130 tests) |
161
+ | `0.2.1-rc.5` | ✅ compatible (rc.5 types/deps + 130 tests) |
162
+ | `0.2.1-rc.3` | ✅ compatible (rc.3 types/deps + 130 tests) |
163
+ | `0.2.1-rc.2` | ✅ current desktop runtime (130 tests + real Cordis contexts) |
164
164
  | `0.2.0-rc.x` | ✅ covered by the peer range |
165
165
  | `0.1.x` | ❌ unsupported (different settings-namespace model) |
166
166
 
package/README.md CHANGED
@@ -52,7 +52,7 @@ MCviseron 的 **DeepSeek Harness(DSH)总插件**:一个 npm 包、一个 `
52
52
 
53
53
  - Windows 桌面版:「设置 → MCviseron 插件 → 重启 / 关闭」子页提供重启与关闭按钮,点击后确认并重启/关闭桌面应用。
54
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)。
55
- - 重启方式:Host 注册一个隐藏的 Task Scheduler PowerShell helper;helper 先等待旧 Electron 主进程与 Host PID 退出(最多 30 秒),再启动应用,避免单实例锁导致新进程直接退出。
55
+ - 重启方式:Host 写一个临时 PowerShell 助手(detached),先关闭 Electron 主进程;Host 在 IPC 断开后按官方流程优雅关闭所有插件与会话;助手等待主进程与 Host 退出后,清除 `ELECTRON_RUN_AS_NODE` 并重新启动应用。
56
56
  - 会中断正在运行的任务(与托盘「退出」的提示一致),不会修改插件、配置或会话记录。
57
57
  - 只在桌面版可用;`dsh web` 下状态接口返回不可用,设置行自动隐藏。
58
58
  - **为什么不做成托盘菜单项**:DSH 的托盘菜单由 Electron 主进程的 `lib/main.js` 直接构建(`DesktopTray`),插件运行在独立的 Host 子进程里,官方没有提供托盘扩展点;因此本组件只能在设置页提供等价入口。
@@ -250,12 +250,12 @@ DSH 0.2 的官方设置 apiproxy 不向浏览器暴露第三方命名空间,
250
250
 
251
251
  | DSH 版本 | 状态 |
252
252
  | --- | --- |
253
- | `0.2.2-rc.5` | ✅ 预适配(0.2.2-rc.5 类型/依赖 + 131 项测试;当前桌面仍为 rc.3) |
254
- | `0.2.2-rc.3` | ✅ 当前桌面安装(rc.3 类型/依赖 + 131 项测试;真实运行时验证) |
255
- | `0.2.2-rc.1` | ✅ 兼容(0.2.2-rc.1 类型/依赖 + 131 项测试) |
256
- | `0.2.1-rc.5` | ✅ 兼容(rc.5 类型/依赖 + 131 项测试) |
257
- | `0.2.1-rc.3` | ✅ 兼容(rc.3 类型/依赖 + 131 项测试) |
258
- | `0.2.1-rc.2` | ✅ 当前桌面运行版本(131 项测试 + 真实 Cordis 上下文) |
253
+ | `0.2.2-rc.5` | ✅ 预适配(0.2.2-rc.5 类型/依赖 + 130 项测试;当前桌面仍为 rc.3) |
254
+ | `0.2.2-rc.3` | ✅ 当前桌面安装(rc.3 类型/依赖 + 130 项测试;真实运行时验证) |
255
+ | `0.2.2-rc.1` | ✅ 兼容(0.2.2-rc.1 类型/依赖 + 130 项测试) |
256
+ | `0.2.1-rc.5` | ✅ 兼容(rc.5 类型/依赖 + 130 项测试) |
257
+ | `0.2.1-rc.3` | ✅ 兼容(rc.3 类型/依赖 + 130 项测试) |
258
+ | `0.2.1-rc.2` | ✅ 当前桌面运行版本(130 项测试 + 真实 Cordis 上下文) |
259
259
  | `0.2.0-rc.x` | ✅ peer 范围覆盖(同一套设置、审批与 hook 接缝) |
260
260
  | `0.1.x` | ❌ 不支持:0.1 的插件自行注册设置命名空间,与本插件的条目 id 命名空间模型不同 |
261
261
 
@@ -321,7 +321,7 @@ test/
321
321
 
322
322
  ```bash
323
323
  pnpm install
324
- pnpm check # typecheck + 131 项测试 + 构建
324
+ pnpm check # typecheck + 130 项测试 + 构建
325
325
  ```
326
326
 
327
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/` 不入库。
package/docs/release.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## 当前状态(2026-12-06)
4
4
 
5
- - 包名 **`dsh-mcviseron-plugin` 当前发布 0.8.4**;0.8.0、0.8.2 未发布,分别由 0.8.1、0.8.3 取代。0.8.4 修复 Windows 重启时旧进程未退出导致新实例不拉起的问题。
5
+ - 包名 **`dsh-mcviseron-plugin` 当前发布 0.8.5**;0.8.0、0.8.2 未发布,分别由 0.8.1、0.8.3 取代。0.8.5 回退 0.8.4 的 Windows 重启 helper,恢复 Task Scheduler 直接启动逻辑。
6
6
  - npm 账号 `mcviseron` 已恢复正常,可执行首次手动发布。
7
7
  - 本机全局 registry 指向 npmmirror,发布时必须显式指定 `--registry=https://registry.npmjs.org/`。
8
8
  - 首次发布 **v0.6.1 已手动完成**;此后由 `.github/workflows/publish.yml` 通过 OIDC Trusted Publishing 发布,tag 推送即发布。
@@ -55,7 +55,7 @@
55
55
 
56
56
  ```powershell
57
57
  npm view dsh-mcviseron-plugin version dist-tags.latest --registry=https://registry.npmjs.org/
58
- curl.exe -sI https://registry.npmjs.org/dsh-mcviseron-plugin/-/dsh-mcviseron-plugin-0.8.4.tgz | Select-Object -First 1
58
+ curl.exe -sI https://registry.npmjs.org/dsh-mcviseron-plugin/-/dsh-mcviseron-plugin-0.8.5.tgz | Select-Object -First 1
59
59
  curl.exe -X PUT "https://registry.npmmirror.com/-/package/dsh-mcviseron-plugin/syncs"
60
60
  ```
61
61
 
@@ -83,7 +83,7 @@ Trusted Publisher 绑定后,**推送 `v*` tag 即直接发布**,不再需要
83
83
 
84
84
  > `workflow_dispatch` 默认只做 `npm pack --dry-run`;要发布当前 `main` 的版本,取消勾选 `dry-run` 再运行。
85
85
  >
86
- > 最近版本:0.7.8 修复 Linux CI 临时目录;0.8.0/0.8.1 加入 Linux/Web/云重启与关闭并修复 CI;0.8.2 跳过;0.8.3 加入侧边栏重启快捷入口;0.8.4 修复 Windows 重启等待旧进程退出。
86
+ > 最近版本:0.7.8 修复 Linux CI 临时目录;0.8.0/0.8.1 加入 Linux/Web/云重启与关闭并修复 CI;0.8.2 跳过;0.8.3 加入侧边栏重启快捷入口;0.8.5 回退 Windows 重启 helper。
87
87
 
88
88
  ## 回滚与故障
89
89
 
package/lib/index.js CHANGED
@@ -12940,7 +12940,6 @@ __export(restart_exports, {
12940
12940
  deriveDesktopAppPath: () => deriveDesktopAppPath,
12941
12941
  inject: () => inject4,
12942
12942
  launchRestart: () => launchRestart,
12943
- makeRestartHelper: () => makeRestartHelper,
12944
12943
  makeRestartRoutes: () => makeRestartRoutes,
12945
12944
  makeTaskScript: () => makeTaskScript,
12946
12945
  resolveProcessRestartTarget: () => resolveProcessRestartTarget,
@@ -13009,11 +13008,11 @@ var RESTART_DELAY_SECONDS = 6;
13009
13008
  function restartLogPath() {
13010
13009
  return join5(tmpdir4(), "dsh-mcviseron-restart.log");
13011
13010
  }
13012
- function makeTaskScript(target, taskName, delaySeconds, helperPath = "") {
13011
+ function makeTaskScript(target, taskName, delaySeconds) {
13013
13012
  const quote = (value) => "'" + value.replace(/'/g, "''") + "'";
13014
13013
  return [
13015
13014
  "$user = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name",
13016
- helperPath === "" ? `$action = New-ScheduledTaskAction -Execute ${quote(target.exePath)} -WorkingDirectory ${quote(dirname(target.exePath))}` : `$action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument ${quote('-NoProfile -NonInteractive -WindowStyle Hidden -ExecutionPolicy Bypass -File "' + helperPath + '"')} -WorkingDirectory ${quote(dirname(target.exePath))}`,
13015
+ `$action = New-ScheduledTaskAction -Execute ${quote(target.exePath)} -WorkingDirectory ${quote(dirname(target.exePath))}`,
13017
13016
  `$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date).AddSeconds(${delaySeconds})`,
13018
13017
  "$principal = New-ScheduledTaskPrincipal -UserId $user -LogonType Interactive -RunLevel Limited",
13019
13018
  `Register-ScheduledTask -TaskName ${quote(taskName)} -Action $action -Trigger $trigger -Principal $principal -Force | Out-Null`,
@@ -13085,35 +13084,16 @@ function closeDesktop(target) {
13085
13084
  }
13086
13085
  }, 300);
13087
13086
  }
13088
- function makeRestartHelper(target, logPath = restartLogPath()) {
13089
- const quote = (value) => "'" + value.replace(/'/g, "''") + "'";
13090
- return [
13091
- '$ErrorActionPreference = "SilentlyContinue"',
13092
- "$mainPid = " + String(target.mainPid ?? 0),
13093
- "$hostPid = " + String(target.hostPid),
13094
- "$deadline = (Get-Date).AddSeconds(30)",
13095
- "while ((Get-Date) -lt $deadline) {",
13096
- " if (-not (Get-Process -Id $mainPid -ErrorAction SilentlyContinue) -and -not (Get-Process -Id $hostPid -ErrorAction SilentlyContinue)) { break }",
13097
- " Start-Sleep -Milliseconds 200",
13098
- "}",
13099
- "Start-Sleep -Milliseconds 700",
13100
- "Start-Process -FilePath " + quote(target.exePath) + " -WorkingDirectory " + quote(dirname(target.exePath)) + " | Out-Null",
13101
- "Add-Content -LiteralPath " + quote(logPath) + ' -Value ((Get-Date).ToString("o") + " helper: launched " + ' + quote(target.exePath.replace(/'/g, "''")) + ") -Encoding UTF8"
13102
- ].join("\n");
13103
- }
13104
13087
  function launchHelper(target) {
13105
13088
  const logFile = restartLogPath();
13106
- let helperPath = "";
13107
13089
  try {
13108
- helperPath = join5(tmpdir4(), "dsh-mcviseron-restart-helper.ps1");
13109
- writeFileSync(helperPath, makeRestartHelper(target), "utf8");
13110
13090
  execFileSync("powershell.exe", [
13111
13091
  "-NoProfile",
13112
13092
  "-NonInteractive",
13113
13093
  "-WindowStyle",
13114
13094
  "Hidden",
13115
13095
  "-Command",
13116
- makeTaskScript(target, RESTART_TASK_NAME, RESTART_DELAY_SECONDS, helperPath)
13096
+ makeTaskScript(target, RESTART_TASK_NAME, RESTART_DELAY_SECONDS)
13117
13097
  ], { windowsHide: true, timeout: 2e4, encoding: "utf8" });
13118
13098
  appendFileSync4(logFile, `${(/* @__PURE__ */ new Date()).toISOString()} host: scheduled ${target.exePath} in ${RESTART_DELAY_SECONDS}s
13119
13099
  `, "utf8");
package/lib/restart.js CHANGED
@@ -120,11 +120,11 @@ var RESTART_DELAY_SECONDS = 6;
120
120
  function restartLogPath() {
121
121
  return join(tmpdir(), "dsh-mcviseron-restart.log");
122
122
  }
123
- function makeTaskScript(target, taskName, delaySeconds, helperPath = "") {
123
+ function makeTaskScript(target, taskName, delaySeconds) {
124
124
  const quote = (value) => "'" + value.replace(/'/g, "''") + "'";
125
125
  return [
126
126
  "$user = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name",
127
- helperPath === "" ? `$action = New-ScheduledTaskAction -Execute ${quote(target.exePath)} -WorkingDirectory ${quote(dirname(target.exePath))}` : `$action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument ${quote('-NoProfile -NonInteractive -WindowStyle Hidden -ExecutionPolicy Bypass -File "' + helperPath + '"')} -WorkingDirectory ${quote(dirname(target.exePath))}`,
127
+ `$action = New-ScheduledTaskAction -Execute ${quote(target.exePath)} -WorkingDirectory ${quote(dirname(target.exePath))}`,
128
128
  `$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date).AddSeconds(${delaySeconds})`,
129
129
  "$principal = New-ScheduledTaskPrincipal -UserId $user -LogonType Interactive -RunLevel Limited",
130
130
  `Register-ScheduledTask -TaskName ${quote(taskName)} -Action $action -Trigger $trigger -Principal $principal -Force | Out-Null`,
@@ -196,35 +196,16 @@ function closeDesktop(target) {
196
196
  }
197
197
  }, 300);
198
198
  }
199
- function makeRestartHelper(target, logPath = restartLogPath()) {
200
- const quote = (value) => "'" + value.replace(/'/g, "''") + "'";
201
- return [
202
- '$ErrorActionPreference = "SilentlyContinue"',
203
- "$mainPid = " + String(target.mainPid ?? 0),
204
- "$hostPid = " + String(target.hostPid),
205
- "$deadline = (Get-Date).AddSeconds(30)",
206
- "while ((Get-Date) -lt $deadline) {",
207
- " if (-not (Get-Process -Id $mainPid -ErrorAction SilentlyContinue) -and -not (Get-Process -Id $hostPid -ErrorAction SilentlyContinue)) { break }",
208
- " Start-Sleep -Milliseconds 200",
209
- "}",
210
- "Start-Sleep -Milliseconds 700",
211
- "Start-Process -FilePath " + quote(target.exePath) + " -WorkingDirectory " + quote(dirname(target.exePath)) + " | Out-Null",
212
- "Add-Content -LiteralPath " + quote(logPath) + ' -Value ((Get-Date).ToString("o") + " helper: launched " + ' + quote(target.exePath.replace(/'/g, "''")) + ") -Encoding UTF8"
213
- ].join("\n");
214
- }
215
199
  function launchHelper(target) {
216
200
  const logFile = restartLogPath();
217
- let helperPath = "";
218
201
  try {
219
- helperPath = join(tmpdir(), "dsh-mcviseron-restart-helper.ps1");
220
- writeFileSync(helperPath, makeRestartHelper(target), "utf8");
221
202
  execFileSync("powershell.exe", [
222
203
  "-NoProfile",
223
204
  "-NonInteractive",
224
205
  "-WindowStyle",
225
206
  "Hidden",
226
207
  "-Command",
227
- makeTaskScript(target, RESTART_TASK_NAME, RESTART_DELAY_SECONDS, helperPath)
208
+ makeTaskScript(target, RESTART_TASK_NAME, RESTART_DELAY_SECONDS)
228
209
  ], { windowsHide: true, timeout: 2e4, encoding: "utf8" });
229
210
  appendFileSync(logFile, `${(/* @__PURE__ */ new Date()).toISOString()} host: scheduled ${target.exePath} in ${RESTART_DELAY_SECONDS}s
230
211
  `, "utf8");
@@ -337,7 +318,6 @@ export {
337
318
  deriveDesktopAppPath,
338
319
  inject,
339
320
  launchRestart,
340
- makeRestartHelper,
341
321
  makeRestartRoutes,
342
322
  makeTaskScript,
343
323
  resolveProcessRestartTarget,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mcviseron-plugin",
3
- "version": "0.8.4",
3
+ "version": "0.8.5",
4
4
  "description": "DeepSeek Harness (DSH) master plugin — one package hosting MCviseron's DSH components as separate bundle entries: a time-based light/dark Appearance schedule, an Auto-review fix (shutdown preset guard + Chinese approval-reason translation), and a todo plan guard that keeps multi-stage work advancing, one-shot after-session restart/close actions with task-aware waiting, and automatic auth-cookie hygiene for repeated desktop restarts, and model-editable official automation tasks.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -182,13 +182,11 @@ function restartLogPath(): string {
182
182
  * @param delaySeconds - how long the task waits before starting the application.
183
183
  * @returns PowerShell registration script text.
184
184
  */
185
- export function makeTaskScript(target: RestartTarget, taskName: string, delaySeconds: number, helperPath = ""): string {
185
+ export function makeTaskScript(target: RestartTarget, taskName: string, delaySeconds: number): string {
186
186
  const quote = (value: string): string => "'" + value.replace(/'/g, "''") + "'"
187
187
  return [
188
188
  '$user = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name',
189
- helperPath === ""
190
- ? `$action = New-ScheduledTaskAction -Execute ${quote(target.exePath)} -WorkingDirectory ${quote(dirname(target.exePath))}`
191
- : `$action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument ${quote('-NoProfile -NonInteractive -WindowStyle Hidden -ExecutionPolicy Bypass -File "' + helperPath + '"')} -WorkingDirectory ${quote(dirname(target.exePath))}`,
189
+ `$action = New-ScheduledTaskAction -Execute ${quote(target.exePath)} -WorkingDirectory ${quote(dirname(target.exePath))}`,
192
190
  `$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date).AddSeconds(${delaySeconds})`,
193
191
  '$principal = New-ScheduledTaskPrincipal -UserId $user -LogonType Interactive -RunLevel Limited',
194
192
  `Register-ScheduledTask -TaskName ${quote(taskName)} -Action $action -Trigger $trigger -Principal $principal -Force | Out-Null`,
@@ -268,38 +266,17 @@ export function closeDesktop(target?: RestartTarget): void {
268
266
  }, 300)
269
267
  }
270
268
 
271
- /** Build a Task Scheduler helper that waits for old processes before starting the app. */
272
- export function makeRestartHelper(target: RestartTarget, logPath = restartLogPath()): string {
273
- const quote = (value: string): string => "'" + value.replace(/'/g, "''") + "'"
274
- return [
275
- '$ErrorActionPreference = "SilentlyContinue"',
276
- '$mainPid = ' + String(target.mainPid ?? 0),
277
- '$hostPid = ' + String(target.hostPid),
278
- '$deadline = (Get-Date).AddSeconds(30)',
279
- 'while ((Get-Date) -lt $deadline) {',
280
- ' if (-not (Get-Process -Id $mainPid -ErrorAction SilentlyContinue) -and -not (Get-Process -Id $hostPid -ErrorAction SilentlyContinue)) { break }',
281
- ' Start-Sleep -Milliseconds 200',
282
- '}',
283
- 'Start-Sleep -Milliseconds 700',
284
- 'Start-Process -FilePath ' + quote(target.exePath) + ' -WorkingDirectory ' + quote(dirname(target.exePath)) + ' | Out-Null',
285
- 'Add-Content -LiteralPath ' + quote(logPath) + ' -Value ((Get-Date).ToString("o") + " helper: launched " + ' + quote(target.exePath.replace(/'/g, "''")) + ') -Encoding UTF8',
286
- ].join('\n')
287
- }
288
-
289
269
  /** Register the direct-launch task, then close the Electron main process. */
290
270
  function launchHelper(target: RestartTarget): void {
291
271
  const logFile = restartLogPath()
292
- let helperPath = ''
293
272
  try {
294
- helperPath = join(tmpdir(), 'dsh-mcviseron-restart-helper.ps1')
295
- writeFileSync(helperPath, makeRestartHelper(target), 'utf8')
296
273
  execFileSync('powershell.exe', [
297
274
  '-NoProfile',
298
275
  '-NonInteractive',
299
276
  '-WindowStyle',
300
277
  'Hidden',
301
278
  '-Command',
302
- makeTaskScript(target, RESTART_TASK_NAME, RESTART_DELAY_SECONDS, helperPath),
279
+ makeTaskScript(target, RESTART_TASK_NAME, RESTART_DELAY_SECONDS),
303
280
  ], { windowsHide: true, timeout: 20_000, encoding: 'utf8' })
304
281
  appendFileSync(logFile, `${new Date().toISOString()} host: scheduled ${target.exePath} in ${RESTART_DELAY_SECONDS}s\n`, 'utf8')
305
282
  } catch (error) {