dsh-mcviseron-plugin 0.7.8 → 0.8.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/lib/restart.js CHANGED
@@ -2,8 +2,8 @@ import { createRequire } from 'node:module';
2
2
  const require = createRequire(import.meta.url);
3
3
 
4
4
  // src/restart/index.ts
5
- import { execFileSync } from "node:child_process";
6
- import { appendFileSync, existsSync } from "node:fs";
5
+ import { execFileSync, spawn } from "node:child_process";
6
+ import { appendFileSync, existsSync, writeFileSync } from "node:fs";
7
7
  import { tmpdir } from "node:os";
8
8
  import { basename, dirname, join, resolve } from "node:path";
9
9
  import z from "@deepseek-ai/schemastery";
@@ -74,7 +74,9 @@ var RESTART_API = {
74
74
  execute: "/api/dsh-mcviseron/restart/execute"
75
75
  };
76
76
  function resolveRestartTarget(execPath, parentPid, exists, override = "", argv = [], platform = process.platform) {
77
- if (platform !== "win32") return void 0;
77
+ if (platform !== "win32") {
78
+ return resolveProcessRestartTarget({ platform, execPath, argv: argv.slice(1), cwd: process.cwd() });
79
+ }
78
80
  if (!Number.isSafeInteger(parentPid) || parentPid <= 0) return void 0;
79
81
  const configured = typeof override === "string" ? override.trim() : "";
80
82
  const candidate = configured !== "" ? configured : deriveDesktopAppPath(execPath, argv, exists);
@@ -83,6 +85,23 @@ function resolveRestartTarget(execPath, parentPid, exists, override = "", argv =
83
85
  if (name === "node" || name === "node.exe") return void 0;
84
86
  return { mainPid: parentPid, hostPid: process.pid, exePath: candidate };
85
87
  }
88
+ function resolveProcessRestartTarget(options = {}) {
89
+ const platform = options.platform ?? process.platform;
90
+ if (platform === "win32") return void 0;
91
+ const argv = options.argv ?? process.argv.slice(1);
92
+ if (argv.length === 0 || argv[0] === "") return void 0;
93
+ const env = options.env ?? process.env;
94
+ const override = (env.DSH_MCVISERON_RESTART_MODE ?? "").trim().toLowerCase();
95
+ const supervised = override === "supervisor-exit" || override === "exit" || override !== "reexec" && (env.INVOCATION_ID !== void 0 || env.JOURNAL_STREAM !== void 0 || env.SYSTEMD_EXEC_PID !== void 0 || env.KUBERNETES_SERVICE_HOST !== void 0 || existsSync("/.dockerenv") || options.pid1 === true || (options.pid ?? process.pid) === 1);
96
+ const nodeArgs = options.execArgv ?? process.execArgv;
97
+ return {
98
+ hostPid: options.pid ?? process.pid,
99
+ exePath: options.execPath ?? process.execPath,
100
+ mode: supervised ? "supervisor-exit" : "reexec",
101
+ argv: [...nodeArgs, ...argv],
102
+ cwd: options.cwd ?? process.cwd()
103
+ };
104
+ }
86
105
  function deriveDesktopAppPath(execPath, argv, exists) {
87
106
  const isNode = (value) => /^node(\.exe)?$/i.test(basename(value));
88
107
  if (!isNode(execPath)) return execPath;
@@ -93,6 +112,9 @@ function deriveDesktopAppPath(execPath, argv, exists) {
93
112
  const candidate = join(resolve(runtimeDir, "../../.."), "DeepSeek Harness.exe");
94
113
  return exists(candidate) ? candidate : execPath;
95
114
  }
115
+ function restartMode(target) {
116
+ return target.mode ?? (target.mainPid !== void 0 ? "desktop" : "reexec");
117
+ }
96
118
  var RESTART_TASK_NAME = "DSH-MCviseron-Restart";
97
119
  var RESTART_DELAY_SECONDS = 6;
98
120
  function restartLogPath() {
@@ -109,14 +131,62 @@ function makeTaskScript(target, taskName, delaySeconds) {
109
131
  ""
110
132
  ].join("\n");
111
133
  }
134
+ function writeRestartLog(message) {
135
+ try {
136
+ appendFileSync(restartLogPath(), (/* @__PURE__ */ new Date()).toISOString() + " " + message + "\n", "utf8");
137
+ } catch {
138
+ }
139
+ }
140
+ var PROCESS_HELPER = [
141
+ "const { spawn } = require('node:child_process')",
142
+ "const [pidText, cwd, exe, ...args] = process.argv.slice(2)",
143
+ "const pid = Number(pidText)",
144
+ "const started = Date.now()",
145
+ "const start = () => {",
146
+ " try {",
147
+ ' const child = spawn(exe, args, { cwd, detached: true, stdio: "ignore", env: process.env })',
148
+ " child.unref()",
149
+ " } catch { /* the supervisor or user will see the failure */ }",
150
+ "}",
151
+ "const timer = setInterval(() => {",
152
+ " let alive = false",
153
+ " try { process.kill(pid, 0); alive = true } catch { /* parent is gone */ }",
154
+ " if (!alive || Date.now() - started > 30_000) { clearInterval(timer); start() }",
155
+ "}, 100)",
156
+ "timer.unref?.()"
157
+ ].join("\n");
158
+ function ensureProcessHelper() {
159
+ const path = join(tmpdir(), "dsh-mcviseron-restart-helper.cjs");
160
+ writeFileSync(path, PROCESS_HELPER, "utf8");
161
+ return path;
162
+ }
163
+ function launchProcessRestart(target) {
164
+ if (target.mode === "supervisor-exit") {
165
+ writeRestartLog("host: supervised restart requested; exit 75");
166
+ setTimeout(() => process.exit(75), 300);
167
+ return;
168
+ }
169
+ try {
170
+ const helper = ensureProcessHelper();
171
+ const args = [helper, String(process.pid), target.cwd ?? process.cwd(), target.exePath, ...target.argv ?? []];
172
+ const child = spawn(process.execPath, args, { detached: true, stdio: "ignore", env: { ...process.env, DSH_MCVISERON_RESTARTED: "1" } });
173
+ child.unref();
174
+ writeRestartLog("host: detached re-exec helper started");
175
+ } catch (error) {
176
+ writeRestartLog("host: re-exec helper failed: " + (error instanceof Error ? error.message : String(error)));
177
+ throw new Error("cannot start the Linux restart helper", { cause: error });
178
+ }
179
+ setTimeout(() => process.exit(0), 300);
180
+ }
112
181
  function launchRestart(target) {
113
- launchHelper(target);
182
+ if (restartMode(target) === "desktop") launchHelper(target);
183
+ else launchProcessRestart(target);
114
184
  }
115
185
  function closeDesktop(target) {
116
- const pid = target?.mainPid ?? process.ppid;
186
+ const mainPid = target?.mainPid;
117
187
  setTimeout(() => {
118
188
  try {
119
- if (target !== void 0 || process.platform === "win32") process.kill(pid);
189
+ if (mainPid !== void 0 && target !== void 0 && restartMode(target) === "desktop") process.kill(mainPid);
120
190
  else process.exit(0);
121
191
  } catch {
122
192
  try {
@@ -145,10 +215,12 @@ function launchHelper(target) {
145
215
  `, "utf8");
146
216
  throw new Error("cannot schedule the restart task: " + message, { cause: error });
147
217
  }
218
+ const mainPid = target.mainPid;
219
+ if (mainPid === void 0) throw new Error("desktop restart target has no main PID");
148
220
  setTimeout(() => {
149
221
  try {
150
- process.kill(target.mainPid);
151
- appendFileSync(logFile, `${(/* @__PURE__ */ new Date()).toISOString()} host: kill sent to ${target.mainPid}
222
+ process.kill(mainPid);
223
+ appendFileSync(logFile, `${(/* @__PURE__ */ new Date()).toISOString()} host: kill sent to ${mainPid}
152
224
  `, "utf8");
153
225
  } catch (error) {
154
226
  appendFileSync(logFile, `${(/* @__PURE__ */ new Date()).toISOString()} host: kill failed: ${error instanceof Error ? error.message : String(error)}
@@ -186,7 +258,7 @@ function makeRestartRoutes(deps) {
186
258
  if (req.method !== "GET" && req.method !== "POST") return json(res, 405, { ok: false, error: "method-not-allowed" });
187
259
  if (!isLoopbackRequest(req)) return json(res, 403, { ok: false, error: "forbidden" });
188
260
  const target = deps.target();
189
- json(res, 200, target === void 0 ? { ok: true, available: false, reason: "desktop-app-unavailable" } : { ok: true, available: true, appPath: target.exePath, mainPid: target.mainPid });
261
+ json(res, 200, target === void 0 ? { ok: true, available: false, reason: "restart-target-unavailable" } : { ok: true, available: true, mode: restartMode(target), appPath: target.exePath, mainPid: target.mainPid ?? null });
190
262
  } catch (error) {
191
263
  json(res, 500, { ok: false, error: error instanceof Error ? error.message : String(error) });
192
264
  }
@@ -203,13 +275,16 @@ function makeRestartRoutes(deps) {
203
275
  if (body === void 0 || typeof body !== "object" || body === null || body.confirm !== true) {
204
276
  return json(res, 400, { ok: false, error: "confirmation-required" });
205
277
  }
278
+ const action = body.action ?? "restart";
279
+ if (action !== "restart" && action !== "close") return json(res, 400, { ok: false, error: "action-invalid" });
206
280
  const latest = now();
207
- if (latest - lastLaunch < 5e3) return json(res, 429, { ok: false, error: "restart-already-scheduled" });
281
+ if (action === "restart" && latest - lastLaunch < 5e3) return json(res, 429, { ok: false, error: "restart-already-scheduled" });
208
282
  const target = deps.target();
209
- if (target === void 0) return json(res, 409, { ok: false, error: "desktop-app-unavailable" });
210
- deps.launch(target);
211
- lastLaunch = latest;
212
- json(res, 200, { ok: true, restarting: true, appPath: target.exePath });
283
+ if (action === "restart" && target === void 0) return json(res, 409, { ok: false, error: "restart-target-unavailable" });
284
+ if (action === "restart") deps.launch(target);
285
+ else (deps.close ?? closeDesktop)(target);
286
+ if (action === "restart") lastLaunch = latest;
287
+ json(res, 200, { ok: true, action, restarting: action === "restart", closing: action === "close", mode: target === void 0 ? null : restartMode(target) });
213
288
  } catch (error) {
214
289
  json(res, 500, { ok: false, error: error instanceof Error ? error.message : String(error) });
215
290
  }
@@ -224,7 +299,8 @@ function apply(ctx, config) {
224
299
  const appPath = typeof plain.appPath === "string" ? plain.appPath : "";
225
300
  const routes = makeRestartRoutes({
226
301
  target: () => resolveRestartTarget(process.execPath, process.ppid, existsSync, appPath, process.argv),
227
- launch: launchHelper
302
+ launch: launchRestart,
303
+ close: closeDesktop
228
304
  });
229
305
  ctx.effect(() => {
230
306
  const disposers = routes.map((route) => ctx.webServer.register(route));
@@ -244,5 +320,7 @@ export {
244
320
  launchRestart,
245
321
  makeRestartRoutes,
246
322
  makeTaskScript,
247
- resolveRestartTarget
323
+ resolveProcessRestartTarget,
324
+ resolveRestartTarget,
325
+ restartMode
248
326
  };
package/lib/task-guard.js CHANGED
@@ -295,6 +295,34 @@ function suggestedTodoPayload(todos, matched) {
295
295
  }));
296
296
  return JSON.stringify({ todos: next });
297
297
  }
298
+ function latestTodos(session) {
299
+ try {
300
+ const events = session.snapshotEvents?.();
301
+ if (!Array.isArray(events)) return null;
302
+ for (let index = events.length - 1; index >= 0; index -= 1) {
303
+ const event = events[index];
304
+ if (event?.type !== "todo/write") continue;
305
+ return readTodos(event.data);
306
+ }
307
+ } catch {
308
+ }
309
+ return null;
310
+ }
311
+ async function migrateStoredTodoList(session, config, ctx) {
312
+ if (!config.translateTodoContent) return;
313
+ const todos = latestTodos(session);
314
+ if (todos === null || todos.length === 0) return;
315
+ const context = noticeContext({ session }, config, ctx);
316
+ if (!context.translate) return;
317
+ const contents = todos.map((todo) => todo.content);
318
+ const translated = await displayTodoContents(contents, context);
319
+ if (!translated.some((value, index) => value !== contents[index])) return;
320
+ if (typeof session.append !== "function") return;
321
+ try {
322
+ session.append("todo/write", { todos: translated.map((content, index) => ({ content, status: todos[index].status })) });
323
+ } catch {
324
+ }
325
+ }
298
326
  function installTaskGuard(ctx, input) {
299
327
  const config = resolveConfig(input);
300
328
  const bus = ctx;
@@ -390,6 +418,7 @@ function installTaskGuard(ctx, input) {
390
418
  });
391
419
  bus.on("agent/pre-step", async (payload, next) => {
392
420
  const sessionId = sessionIdOf(payload.agent);
421
+ void migrateStoredTodoList(payload.agent.session, config, ctx);
393
422
  if (sessionId !== "") intentBuffers.delete(sessionId);
394
423
  const state = sessions.get(sessionId);
395
424
  if (state !== void 0) {
@@ -419,12 +448,14 @@ function installTaskGuard(ctx, input) {
419
448
  if (event.type === "turn/start" || event.type === "turn/end") {
420
449
  sessions.delete(sessionId);
421
450
  intentBuffers.delete(sessionId);
451
+ void migrateStoredTodoList(session, config, ctx);
422
452
  return;
423
453
  }
424
454
  if (event.type === "todo/write") {
425
455
  const todos = readTodos(event.data);
426
456
  if (todos !== null) resetState(sessions, sessionId, todos);
427
457
  intentBuffers.delete(sessionId);
458
+ void migrateStoredTodoList(session, config, ctx);
428
459
  }
429
460
  });
430
461
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mcviseron-plugin",
3
- "version": "0.7.8",
3
+ "version": "0.8.3",
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": {
@@ -371,6 +371,7 @@ export function apply(ctx: Context): void {
371
371
  text: [
372
372
  'Official DSH automation tasks are writable from this conversation.',
373
373
  'Use automation_task_list / automation_task_create / automation_task_update / automation_task_delete; they call the Host schedule service and persist automatically.',
374
+ 'Host Schedule API (DSH 0.2.2+): list({}) returns { items }; create({ title, prompt, timing, target }, sessionId, signal); edit({ id, action: "update", patch }, sessionId, signal); edit({ id, action: "delete" }, sessionId, signal). Older hosts expose list({ sessionId }), create(sessionId, request), update and delete; these tools normalize both shapes.',
374
375
  'Never edit ~/.dsh/storages/schedule.json by hand, and never tell the user to use a command to change a task when these tools are available.',
375
376
  ].join(' '),
376
377
  })
@@ -7,10 +7,11 @@ const EXECUTE = '/api/dsh-mcviseron/restart/execute'
7
7
 
8
8
  type RestartState =
9
9
  | { kind: 'loading' }
10
- | { kind: 'ready'; appPath: string }
10
+ | { kind: 'ready'; appPath: string; mode: string }
11
11
  | { kind: 'unavailable' }
12
12
  | { kind: 'route-missing' }
13
13
  | { kind: 'restarting' }
14
+ | { kind: 'closing' }
14
15
  | { kind: 'failed'; message: string }
15
16
 
16
17
  async function readError(response: Response): Promise<string> {
@@ -38,10 +39,10 @@ export function RestartCard({ t }: { t: (key: McviseronKey) => string }) {
38
39
  return
39
40
  }
40
41
  if (!response.ok) throw new Error(await readError(response))
41
- const body = await response.json() as { ok?: unknown; available?: unknown; appPath?: unknown }
42
+ const body = await response.json() as { ok?: unknown; available?: unknown; appPath?: unknown; mode?: unknown }
42
43
  if (body.ok !== true) throw new Error('restart-status-rejected')
43
44
  if (body.available === true) {
44
- setState({ kind: 'ready', appPath: typeof body.appPath === 'string' ? body.appPath : '' })
45
+ setState({ kind: 'ready', appPath: typeof body.appPath === 'string' ? body.appPath : '', mode: typeof body.mode === 'string' ? body.mode : 'desktop' })
45
46
  } else {
46
47
  setState({ kind: 'unavailable' })
47
48
  }
@@ -71,9 +72,32 @@ export function RestartCard({ t }: { t: (key: McviseronKey) => string }) {
71
72
  }
72
73
  }
73
74
 
75
+ const startClose = async (): Promise<void> => {
76
+ if (!window.confirm(t('page.restart.closeConfirm'))) return
77
+ setState({ kind: 'closing' })
78
+ try {
79
+ const response = await fetch(EXECUTE, {
80
+ method: 'POST',
81
+ headers: { 'content-type': 'application/json' },
82
+ body: JSON.stringify({ confirm: true, action: 'close' }),
83
+ })
84
+ if (!response.ok) throw new Error(await readError(response))
85
+ const body = await response.json() as { ok?: unknown }
86
+ if (body.ok !== true) throw new Error('close-rejected')
87
+ } catch (error) {
88
+ setState({ kind: 'failed', message: error instanceof Error ? error.message : String(error) })
89
+ }
90
+ }
91
+
74
92
  const status = state.kind === 'ready'
75
- ? t('page.restart.ready')
76
- : state.kind === 'route-missing'
93
+ ? state.mode === 'reexec'
94
+ ? t('page.restart.modeProcess')
95
+ : state.mode === 'supervisor-exit'
96
+ ? t('page.restart.modeSupervisor')
97
+ : t('page.restart.ready')
98
+ : state.kind === 'closing'
99
+ ? t('page.restart.closing')
100
+ : state.kind === 'route-missing'
77
101
  ? t('page.restart.routeMissing')
78
102
  : state.kind === 'restarting'
79
103
  ? t('page.restart.restarting')
@@ -84,6 +108,7 @@ export function RestartCard({ t }: { t: (key: McviseronKey) => string }) {
84
108
  : t('page.restart.unavailable')
85
109
 
86
110
  const canRestart = state.kind === 'ready' || state.kind === 'failed'
111
+ const canClose = state.kind === 'ready'
87
112
 
88
113
  return (
89
114
  <div style={pageStyles.card}>
@@ -102,6 +127,14 @@ export function RestartCard({ t }: { t: (key: McviseronKey) => string }) {
102
127
  >
103
128
  {state.kind === 'restarting' ? t('page.restart.restarting') : t('page.restart.button')}
104
129
  </button>
130
+ <button
131
+ type="button"
132
+ disabled={!canClose}
133
+ onClick={() => { void startClose() }}
134
+ style={canClose ? styles.button : styles.buttonDisabled}
135
+ >
136
+ {state.kind === 'closing' ? t('page.restart.closing') : t('page.restart.close')}
137
+ </button>
105
138
  </div>
106
139
  </div>
107
140
  )
@@ -209,6 +209,10 @@ export function SettingsSection({ t }: SettingsSectionProps) {
209
209
  <span style={pageStyles.componentName}>{t('page.components.sessionEnd')}</span>
210
210
  <span style={pageStyles.componentHint}>{t('page.components.sessionEndHint')}</span>
211
211
  </div>
212
+ <div style={pageStyles.componentRow}>
213
+ <span style={pageStyles.componentName}>{t('page.components.automationTasks')}</span>
214
+ <span style={pageStyles.componentHint}>{t('page.components.automationTasksHint')}</span>
215
+ </div>
212
216
  {archive?.available
213
217
  ? (
214
218
  <div style={pageStyles.componentRow}>
@@ -0,0 +1,85 @@
1
+ import { useEffect, useState } from 'react'
2
+ import type { McviseronKey } from './locales.ts'
3
+
4
+ const STATUS = '/api/dsh-mcviseron/restart/status'
5
+ const EXECUTE = '/api/dsh-mcviseron/restart/execute'
6
+
7
+ interface Props {
8
+ wide?: boolean
9
+ t: (key: McviseronKey) => string
10
+ }
11
+
12
+ /** One sidebar footer action: restart DSH without opening Settings. */
13
+ export function SidebarRestartAction({ wide = true, t }: Props) {
14
+ const [available, setAvailable] = useState<boolean | null>(null)
15
+ const [busy, setBusy] = useState(false)
16
+
17
+ useEffect(() => {
18
+ let cancelled = false
19
+ void (async () => {
20
+ try {
21
+ const response = await fetch(STATUS, { method: 'GET', cache: 'no-store', credentials: 'same-origin' })
22
+ if (cancelled) return
23
+ if (!response.ok) { setAvailable(false); return }
24
+ const body = await response.json() as { available?: unknown }
25
+ setAvailable(body.available === true)
26
+ } catch {
27
+ if (!cancelled) setAvailable(false)
28
+ }
29
+ })()
30
+ return () => { cancelled = true }
31
+ }, [])
32
+
33
+ if (available !== true) return null
34
+
35
+ const restart = async (): Promise<void> => {
36
+ if (busy || !window.confirm(t('page.restart.confirm'))) return
37
+ setBusy(true)
38
+ try {
39
+ const response = await fetch(EXECUTE, {
40
+ method: 'POST',
41
+ headers: { 'content-type': 'application/json' },
42
+ credentials: 'same-origin',
43
+ body: JSON.stringify({ confirm: true, action: 'restart' }),
44
+ })
45
+ if (!response.ok) throw new Error('HTTP ' + String(response.status))
46
+ const body = await response.json() as { ok?: unknown }
47
+ if (body.ok !== true) throw new Error('restart-rejected')
48
+ } catch (error) {
49
+ setBusy(false)
50
+ window.alert(t('page.restart.failed') + ': ' + (error instanceof Error ? error.message : String(error)))
51
+ }
52
+ }
53
+
54
+ return (
55
+ <button
56
+ type="button"
57
+ title={t('sidebar.restart')}
58
+ aria-label={t('sidebar.restart')}
59
+ disabled={busy}
60
+ onClick={() => { void restart() }}
61
+ style={{
62
+ display: 'flex',
63
+ alignItems: 'center',
64
+ justifyContent: wide ? 'flex-start' : 'center',
65
+ gap: wide ? 8 : 0,
66
+ width: '100%',
67
+ padding: wide ? '8px 12px' : '8px',
68
+ border: 0,
69
+ borderRadius: 8,
70
+ background: 'transparent',
71
+ color: 'inherit',
72
+ cursor: busy ? 'wait' : 'pointer',
73
+ font: 'inherit',
74
+ textAlign: 'left',
75
+ opacity: busy ? 0.6 : 1,
76
+ }}
77
+ >
78
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden>
79
+ <path d="M13 5.2A5.5 5.5 0 1 0 13.4 10" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" />
80
+ <path d="M13 2.8v3.4H9.6" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
81
+ </svg>
82
+ {wide ? <span>{busy ? t('sidebar.restarting') : t('sidebar.restart')}</span> : null}
83
+ </button>
84
+ )
85
+ }
@@ -8,6 +8,7 @@ import { AppearanceScheduleRow } from './AppearanceScheduleRow.tsx'
8
8
  import { FallbackRestartRow } from './FallbackRestartRow.tsx'
9
9
  import { SessionEndControl } from './SessionEndControl.tsx'
10
10
  import { SettingsSection } from './SettingsSection.tsx'
11
+ import { SidebarRestartAction } from './SidebarRestartAction.tsx'
11
12
  import { ScheduleDriver, type ThemeFace } from './driver.ts'
12
13
  import { en, zh, type McviseronKey } from './locales.ts'
13
14
  import { sectionPresence } from './section-presence.ts'
@@ -135,6 +136,13 @@ export function apply(ctx: ClientContext): void {
135
136
  locale: NS,
136
137
  }, SessionEndControl)
137
138
 
139
+ registerSafely(ctx, 'sidebar.footer.action', {
140
+ id: 'mcviseron-restart',
141
+ order: 90,
142
+ label: '重启 DSH',
143
+ locale: NS,
144
+ }, SidebarRestartAction)
145
+
138
146
  registerSafely(ctx, 'settings.section', {
139
147
  id: 'mcviseron',
140
148
  order: 115,
@@ -38,18 +38,25 @@ export const zh = {
38
38
 
39
39
  'page.title': 'MCviseron 插件',
40
40
  'page.description': '总插件的组件设置。外观设置仍在「通用 → 外观」中。',
41
- 'page.tab.restart': '重启',
41
+ 'page.tab.restart': '重启 / 关闭',
42
42
  'page.tab.components': '组件',
43
- 'page.restart.title': '重启 DeepSeek Harness',
44
- 'page.restart.description': '关闭并重新启动桌面应用;正在运行的任务会被中断',
43
+ 'page.restart.title': '重启 / 关闭 DeepSeek Harness',
44
+ 'page.restart.description': '重启或关闭当前 DSH(桌面应用、Linux/Web 进程或云托管容器);正在运行的任务会被中断',
45
45
  'page.restart.ready': '可用',
46
- 'page.restart.unavailable': '当前环境不支持重启(仅 Windows 桌面版可用)',
46
+ 'page.restart.modeProcess': 'Linux/Web 进程:将重新拉起当前 dsh 命令',
47
+ 'page.restart.modeSupervisor': '由 systemd / Docker / Kubernetes 托管:退出后由托管器重启',
48
+ 'page.restart.close': '关闭 DSH',
49
+ 'page.restart.closing': '正在关闭…',
50
+ 'page.restart.closeConfirm': '确定要关闭 DSH 吗?重启/关闭动作会中断正在运行的任务。',
51
+ 'page.restart.unavailable': '当前环境没有可用的重启目标',
47
52
  'page.restart.routeMissing': '重启接口未加载:请确认 mcviseron-restart 条目已启用',
48
53
  'page.restart.appPath': '应用路径',
49
54
  'page.restart.button': '重启',
50
55
  'page.restart.restarting': '正在重启…窗口会短暂关闭',
51
56
  'page.restart.failed': '重启失败,请重试',
52
57
  'page.restart.confirm': '确定要重启 DeepSeek Harness 吗?正在运行的任务会被中断。',
58
+ 'sidebar.restart': '重启 DSH',
59
+ 'sidebar.restarting': '正在重启…',
53
60
  'page.components.title': '组件',
54
61
  'page.components.appearance': '外观 · 按时间切换',
55
62
  'page.components.appearanceHint': '设置位于「通用 → 外观」',
@@ -57,8 +64,8 @@ export const zh = {
57
64
  'page.components.autoReviewFixHint': '本页「Auto review 修复」子页',
58
65
  'page.components.taskGuard': 'Todo 计划守卫',
59
66
  'page.components.taskGuardHint': '本页「Todo 守卫」子页',
60
- 'page.components.restart': '重启 DeepSeek Harness',
61
- 'page.components.restartHint': '本页「重启」子页',
67
+ 'page.components.restart': '重启 / 关闭 DSH',
68
+ 'page.components.restartHint': '本页「重启 / 关闭」子页',
62
69
  'page.components.note': '组件配置写入 master 条目(mcviseron)的 Config;若组件仍使用旧值,重启 DSH 后生效。',
63
70
  'page.fallback.note': '设置分区未加载,重启入口暂时回退到通用设置。',
64
71
  'page.tab.autoReview': 'Auto review 修复',
@@ -104,8 +111,8 @@ export const zh = {
104
111
  'form.taskGuard.maxListItems': 'notice 最多列出任务数',
105
112
  'form.taskGuard.detectStepIntent': '识别步骤意图',
106
113
  'form.taskGuard.detectStepIntentHint': '识别「Now I will …」等步骤意图,以及「All nets routed」「DRC passes」「原理图完成」等阶段完成语句;命中时提供可直接发送的 todo_write',
107
- 'form.taskGuard.translateTodo': '中文展示 todo 标题',
108
- 'form.taskGuard.translateTodoHint': '只影响 notice 展示,不改写模型写入的 todo',
114
+ 'form.taskGuard.translateTodo': '中文 todo 标题(写入并显示)',
115
+ 'form.taskGuard.translateTodoHint': 'todo_write 标题写成 中文(English);已有列表在下一次 turn 自动迁移,状态不变',
109
116
  'form.taskGuard.todoTimeout': 'todo 翻译超时(毫秒)',
110
117
  'form.taskGuard.include': '只统计这些工具',
111
118
  'form.taskGuard.exclude': '不统计这些工具',
@@ -129,6 +136,8 @@ export const zh = {
129
136
  'page.components.authCookieHint': '自动运行,无设置',
130
137
  'page.components.sessionEnd': '会话后动作',
131
138
  'page.components.sessionEndHint': '输入框左侧的「会话后重启」下拉',
139
+ 'page.components.automationTasks': '自动化任务 API',
140
+ 'page.components.automationTasksHint': 'automation_task_list/create/update/delete;Host schedule.list/create/edit,详见 docs/automation-tasks.md',
132
141
  'page.components.archive': '归档时间(可选)',
133
142
  'page.components.archiveHint': '检测到第三方归档插件时显示',
134
143
  'form.sessionEnd.enabled': '启用会话后动作',
@@ -183,18 +192,25 @@ export const en = {
183
192
 
184
193
  'page.title': 'MCviseron plugin',
185
194
  'page.description': 'Settings for the master plugin components. Appearance still lives under General → Appearance.',
186
- 'page.tab.restart': 'Restart',
195
+ 'page.tab.restart': 'Restart / close',
187
196
  'page.tab.components': 'Components',
188
- 'page.restart.title': 'Restart DeepSeek Harness',
189
- 'page.restart.description': 'Closes and relaunches the desktop application; running tasks are interrupted',
197
+ 'page.restart.title': 'Restart / close DeepSeek Harness',
198
+ 'page.restart.description': 'Restart or close DSH (desktop app, Linux/Web process, or cloud container); running tasks are interrupted',
190
199
  'page.restart.ready': 'Available',
191
- 'page.restart.unavailable': 'Restarting is available only in the Windows desktop app',
200
+ 'page.restart.modeProcess': 'Linux/Web process: relaunch the current dsh command',
201
+ 'page.restart.modeSupervisor': 'Managed by systemd / Docker / Kubernetes: exit and let the supervisor restart it',
202
+ 'page.restart.close': 'Close DSH',
203
+ 'page.restart.closing': 'Closing…',
204
+ 'page.restart.closeConfirm': 'Close DSH? Restart/close interrupts running tasks.',
205
+ 'page.restart.unavailable': 'No restart target is available in this environment',
192
206
  'page.restart.routeMissing': 'The restart route is not loaded: check that the mcviseron-restart entry is enabled',
193
207
  'page.restart.appPath': 'App path',
194
208
  'page.restart.button': 'Restart',
195
209
  'page.restart.restarting': 'Restarting… the window will close briefly',
196
210
  'page.restart.failed': 'Restart failed — try again',
197
211
  'page.restart.confirm': 'Restart DeepSeek Harness now? Running tasks will be interrupted.',
212
+ 'sidebar.restart': 'Restart DSH',
213
+ 'sidebar.restarting': 'Restarting…',
198
214
  'page.components.title': 'Components',
199
215
  'page.components.appearance': 'Appearance · light/dark by time',
200
216
  'page.components.appearanceHint': 'Configured under General → Appearance',
@@ -202,8 +218,8 @@ export const en = {
202
218
  'page.components.autoReviewFixHint': 'The Auto-review fix tab on this page',
203
219
  'page.components.taskGuard': 'Todo plan guard',
204
220
  'page.components.taskGuardHint': 'The Todo guard tab on this page',
205
- 'page.components.restart': 'Restart DeepSeek Harness',
206
- 'page.components.restartHint': 'The Restart tab on this page',
221
+ 'page.components.restart': 'Restart / close DSH',
222
+ 'page.components.restartHint': 'The Restart / close tab on this page',
207
223
  'page.components.note': 'Component settings are written to the mcviseron entry config; restart DSH if a component still uses the old value.',
208
224
  'page.fallback.note': 'The settings section is unavailable, so the restart entry falls back to General.',
209
225
  'page.tab.autoReview': 'Auto-review fix',
@@ -249,8 +265,8 @@ export const en = {
249
265
  'form.taskGuard.maxListItems': 'Maximum tasks listed in a notice',
250
266
  'form.taskGuard.detectStepIntent': 'Detect step intent',
251
267
  'form.taskGuard.detectStepIntentHint': 'Recognizes step intent (“Now I will …”) and completion statements (“All nets routed”, “DRC passes”); the notice carries a ready todo_write',
252
- 'form.taskGuard.translateTodo': 'Show todo titles in Chinese',
253
- 'form.taskGuard.translateTodoHint': 'Display-only; stored todos are never rewritten',
268
+ 'form.taskGuard.translateTodo': 'Chinese todo titles (stored and displayed)',
269
+ 'form.taskGuard.translateTodoHint': 'Stores titles as Chinese (English); migrates existing lists on the next turn without changing statuses',
254
270
  'form.taskGuard.todoTimeout': 'Todo translation timeout (ms)',
255
271
  'form.taskGuard.include': 'Count only these tools',
256
272
  'form.taskGuard.exclude': 'Exclude these tools',
@@ -274,6 +290,8 @@ export const en = {
274
290
  'page.components.authCookieHint': 'Runs automatically; no settings',
275
291
  'page.components.sessionEnd': 'After-session action',
276
292
  'page.components.sessionEndHint': 'The “Restart after session” dropdown left of the composer',
293
+ 'page.components.automationTasks': 'Automation task API',
294
+ 'page.components.automationTasksHint': 'automation_task_list/create/update/delete; Host schedule.list/create/edit; see docs/automation-tasks.md',
277
295
  'page.components.archive': 'Archive time (optional)',
278
296
  'page.components.archiveHint': 'Shown only when the third-party archive plugin is detected',
279
297
  'form.sessionEnd.enabled': 'Enable after-session actions',